[jboss-user] [JBoss Seam] - h:selectManyCheckbox and enums

stu2 do-not-reply at jboss.com
Thu Mar 8 20:06:48 EST 2007


I'm trying to populate a group of checkboxes from enum values.  I've gotten it working so that it displays properly (all checkboxes properly appear) but I get a converter exception when I submit the form.  I wasn't able to find any examples of selectMany anything in the example apps, so forgive me if this is a basic question!  

Anyway, here's the exception I'm seeing:


  | [ExceptionFilter] exception root cause
  | java.lang.NullPointerException
  | 	at org.apache.myfaces.shared_impl.renderkit._SharedRendererUtils.getConvertedUISelectManyValue(_SharedRendererUtils.java:147)
  | 	at org.apache.myfaces.shared_impl.renderkit.RendererUtils.getConvertedUISelectManyValue(RendererUtils.java:673)
  | 	at org.apache.myfaces.shared_impl.renderkit.html.HtmlCheckboxRendererBase.getConvertedValue(HtmlCheckboxRendererBase.java:299)
  | 	at javax.faces.component.UISelectMany.getConvertedValue(UISelectMany.java:326)
  | 	at javax.faces.component.UIInput.validate(UIInput.java:349)
  | 	at javax.faces.component.UISelectMany.validate(UISelectMany.java:315)
  | 	at javax.faces.component.UIInput.processValidators(UIInput.java:183)
  | 	at javax.faces.component.UIForm.processValidators(UIForm.java:70)
  | 	at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:624)
  | 	at javax.faces.component.UIViewRoot.processValidators(UIViewRoot.java:146)
  | 	at org.ajax4jsf.framework.ajax.AjaxViewRoot.access$201(AjaxViewRoot.java:53)
  | 

My SFSB looks like this (only relevant bits included):


  |     private ValidationCategory [] validationCategories;
  | 
  | 	public ValidationCategory [] getValidationCategories() {
  | 		return validationCategories;
  | 	}
  | 
  | 	public ValidationCategory [] getAllValidationCategories() {
  | 		return ValidationCategory.values();
  | 	}
  | 
  | 	public void setValidationCategories(ValidationCategory [] validationCategories) {
  | 		System.out.println("Setting val categories.  Size is " + validationCategories.length);
  | 		this.validationCategories = validationCategories;
  | 	}
  | 

And the facelets section for the form is this:


  | 	<h:form id="productTypeForm">
  | 		<h:selectManyCheckbox id="productTypes" value="#{feedMapping.validationCategories}">
  | 			<s:selectItems value="#{feedMapping.allValidationCategories}"
  | 				var="item" label="${item.name}" />
  | 		</h:selectManyCheckbox>
  | 	<div>
  | 		<h:commandButton value="Continue"
  | 			action="#{feedMapping.selectProductTypes}">
  | 			<s:conversationId />
  | 		</h:commandButton>
  | 	</div>
  | 	</h:form>
  | 

I've tried several permuations of how to represent the selected values: as a List and in this case as an [] since I found a JSF forum post saying this was how it worked.

s:selectItems is supposed to automatically register a converter for Enums, and it seems to be working for rendering the group.  But can anyone suggest how I could capture the selected results?

Thanks! 

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4026491#4026491

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4026491



More information about the jboss-user mailing list