You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Janne Mattila <ja...@hotmail.com> on 2004/08/24 13:55:30 UTC

Complicated select - option structure?

I am toying around with a simple test application. In one page user creates 
a new record, and picks the artist for that record with a select pulldown. 
My artist object has a first name and a last name separately. Initially I 
displayed only last name:

      <html-el:select property="artistId">
        <html-el:optionsCollection property="allArtists" value="id" 
label="lastName"/>
      </html-el:select>

Quite nice and compact. When I wanted to include also the last name, best I 
could come up with was:

      <html-el:select property="artistId">
        <c:forEach var="artist" items="${recordForm.allArtists}">
          <html-el:option value="${artist.id}">
            <c:out value="${artist.firstName} ${artist.lastName}"/>
          </html-el:option>
        </c:forEach>
      </html-el:select>

It seems quite complicated - is there any way to use EL and 
optionsCollectionTag, for example, to achieve a simpler structure?

_________________________________________________________________
Tired of spam? Get advanced junk mail protection with MSN 8. 
http://join.msn.com/?page=features/junkmail


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org