• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Dynamically create JSF components

 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a selectManyListBox. I want to populate the selectItems dynamically at runtime using JSTL. My code is something like this:

<h:selectManyListbox id="manyList">
<c:forEach var="s" items="${myCollection}" >
<f:selectItem itemValue="<c ut value="${s.id}"/>" itemLabel=<c ut... />
</c:forEach>
</h:selectManyListbox>


My code is failing. Does anyone have a simple example of how to do this?
Seems like this should be really easy.

thanks,
 
Justin Krettabull
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I figured it out.

In Rational Application Developer6, click on the 'selectManyList' component in design view. Then go to properties and select 'Add set of choices'. In there, you tell it the name of the collection and the contained type, and the field(s) to display.

The code ends up looking as such:

<h:selectManyListbox id="manyList">
<f:selectItems value="#items.sessionScope.types.description.description.toArray}" />
</h:selectManyListbox>

The output is a multi-select dropdown list populated with data from a Collection in sessionScope.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic