[jboss-user] [JBoss Seam] - How to send a parameter with checkbox in JSF in order to get

lara do-not-reply at jboss.com
Mon Dec 11 06:26:38 EST 2006


I have an object of type Group. Each group has an ID, name & description. I want to list the groups and add a checkbox next to each one. In the form, I have a button Add, when it is clicked, I should be able to get first all the groups selected. I want to know how can I send the ID of the checked group with the <h:selectBooleanCheckbox> because I need to have the ID in the bean in order to perform some actions. Is that possinle?

The code in the JSF looks as follow:


  | <h:dataTable var="group" value="#{groupList}" rendered="#{groupList.rowCount>0}">
  |  	
  |       <h:column>
  | 	 <f:facet name="header">
  | 		<h:outputText/>					 
  | 	  </f:facet>	
  | 	     <h:selectBooleanCheckbox    
  |             value="#{addExecutorToGroup.groupsSelected}">
  |            </h:selectBooleanCheckbox>
  | 	</h:column>	
  | 		
  | 	<h:column>
  | 	 <f:facet name="header">
  | 		<h:outputText value="#{msg.name}"/>					 
  | 	</f:facet>	
  | 		<h:outputText value="#{group.name}" />	
  | 	</h:column>
  | 
  | 	<h:column>
  | 	 <f:facet name="header">
  | 		 <h:outputText value="#{msg.description}" />
  | 	 </f:facet>
  | 		<h:outputText value="#{group.description}" />
  | 	</h:column>  	    	
  |    
  |  </h:dataTable> 
  | 

Note that value="#{groupList}"  is the List of groups and groupsSelected is a boolean variable which has it setter and getter defined in the bean.
What I did for now is to save the list of boolean variable into an array and for example, if the second index contains a value true, I check the second element in the groupList and gets its ID from the bean. This doesn't work when I add sorting and things will be confused that is why I want to send the ID from the JSF page. Can anyone propose any solution?


Any help is appreciated!
Thanks in advance.
Regards

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

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



More information about the jboss-user mailing list