Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

JSF with Facelets : ui:repeat form submit

843844Feb 20 2009 — edited Mar 2 2009
I am using a JSF framework for my web app with Facelets(.xhtml) as the view.
I have a form which gets rendered using ui:repeat tag of facelets(database returns multiple rows which I iterate through the ui:repeat and display the data along with text fields for using to enter some data pertaining to the data returned from the database for each row).
The form contains checkboxex and some input fields, now the rows are rendered correctly but the problem I am facing is am not able to pass on the data entered by user to the backing bean.
When I try to submit the form (my submit button is outside ui:repear because I want all user data entered to be submitted as a single form) only first row of the ui:repeat is passed to the backing bean.
My question is that is there a way by which I can submit all the values within a form rendered using ui:repeat tag of facelets.
<table>
	<tr>
		<td>
		<h:form>
			<ui:repeat value="#{BeanName}" var="var">
				<tr>
					<td>
						<h:selectBooleanCheckbox id="someId" binding="#{var.chkMaleFemale}">
						</h:selectBooleanCheckbox>
						<h:outputText id="someTextId" value="#{var.field1}">
						</h:outputText>
					</td>
				</tr>
			</ui:repeat>
	<h:commandButton type="submit" value="Submit Selection" id="buttonSelect" action="#{BeanName.submit}"> 
	</h:commandButton>
		</h:form>
	</td>
	</tr>
</table>
		
In the backing bean named 'BeanName' I have a method named submit() but I am not able to figure out how do I get the checkBox status for as many number of rows returned from the ui:repeat.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 30 2009
Added on Feb 20 2009
2 comments
520 views