aspose file tools*
The moose likes JSF and the fly likes c:forEach builds s:selectMany Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "c:forEach builds s:selectMany" Watch "c:forEach builds s:selectMany" New topic
Author

c:forEach builds s:selectMany

nimo frey
Ranch Hand

Joined: Jun 28, 2008
Posts: 580
Hello,

I have a problem:
I build this
<blockquote>code:
<pre name="code" class="core"><h:column>
<h:selectManyCheckbox id="n" value="#{bean.selectedItems}" layout="pageDirection">
<c:forEach items="#{bean.list}" var="i" >
<f:selectItem itemLabel="#{i.name}" itemValue="#{i.id}"/>
</c:forEach>
</h:selectManyCheckbox>
</h:column>
</pre>
</blockquote>

but after selecting, only the Items of the LAST column are collected into the list "selectedItems". Is there any possibility to store the selected values elsewhere? My Client-HTML shows individual ID's for every f:selectItem-Tag. When I insert a id:

<blockquote>code:
<pre name="code" class="core"><f:selectItem id="static" itemLabel="#{i.name}" itemValue="#{i.id}"/></pre>
</blockquote>

then the error "duplicate Id for a component.." occurs.

Any ideas? I need to insert the selectItems into the column!
nimo frey
Ranch Hand

Joined: Jun 28, 2008
Posts: 580
I mean, "...are collected into the list "selectedItems", when I choose Items. When I choose Items, which are in the other rows, then these does not appear in my list "selectedItems". I use facelets..is there a tag, which ensures me the association between h:selectManyCheckbox and f:selectItem ??
nimo frey
Ranch Hand

Joined: Jun 28, 2008
Posts: 580
Is there an alternative way,
to collect data from the selected checkboxes?

I am not sure bout the many tags,
such as f:attribute, f:param, f:facet or the binding-attribute.

Exists (a best-practice) way
to collect the data independently
from the the component selectManyCheckbox?
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16250
    
  21

Yes. Don't use JSTL. JSTL and JSF don't mix well.

Instead of coding logic on your display page, define the display as a JSF datatable.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: c:forEach builds s:selectMany