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!

I give up. JSF checkbox in every table row

843842Jan 2 2005 — edited Mar 10 2010
I have not been able to understand the concept of a checkbox to mark a table row for selection using Java server faces. I am from the PHP world which this is easy.

<INPUT TYPE=checkbox NAME="doc[]" value=".....">


I get a array of the checkbox values. in a variable $doc

When I use the following

<h:dataTable id="t" value="#{dbquery.getopentournaments}" var="tournament">
<h:column>
<h:selectManyCheckbox value="#{dbquery.tournament}" id="cbox">
<f:selectItem itemValue="#{tournament.eventid}"/>
</h:selectManyCheckbox>
</h:column>

where dbquery.getopentournaments returns a CachedRowSetImpl from a database query

dbquery.tournament is a String Array

I believe that the object dbquery.tournament should contain the array of values checked from selectItem populated by #{tournament.eventid}

but I don't think this works.

I have seen other information on how to select rows for deletion but the explanation assumes I know something about java & JSF. I am try to learn common processes that all web applications require using JSF using a IDE while learning JSF without try to code JAVA.

eg

the following

<h:form id="mailbox">
<h:data_table value="#{mailsForm.mails}" var="mailBean">
<h:column>
<f:facet>
<h:output_text value="Selected"/>
</f:facet>
<h:selectboolean_checkbox id="selected" value="#{mailBean.selected}"/>
</h:column>
<h:column>
<f:facet>
<h:output_text value="From"/>
</f:facet>
<h:output_text id="from" value="#{mailBean.from}"/>
</h:column>
...
</h:data_table>
<h:command_button id="delete" action="#{mybean.delete}"/>
</h:form>


but the javabean code is missing and an explation why mailBean.selected is reference as the value for <h:selectboolean_checkbox id="selected"

This last example seems to be a common method but a verbose complete explanation is missing with all code required to make this work.
Thanks if you can provide some direction.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 7 2010
Added on Jan 2 2005
21 comments
995 views