• 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

html:option woes

 
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am trying to use the html ption tag to populate a select. Here's the relevant block of the jsp:

The problem is that this results in the option of the select being literally
<option value="<bean:write name='pkg' property='packageSearchPath'>
for each item. What am I doing wrong?

Thanks

[ November 15, 2005: Message edited by: Andrew McLaren ]
[ November 15, 2005: Message edited by: Andrew McLaren ]
 
Bartender
Posts: 1845
10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can't nest tags as attributes to other tags.
You would have to use a <%= pkg.getPackageSearchPath() %> expression to get it in there, which means you would have to specify type on the <logic:iterate> tag.
Rather than using <logic:iterate> and <html:option>, the better approach would be to use either the <html:options> tag or the <html:optionsCollection> tag

http://struts.apache.org/struts-doc-1.2.x/userGuide/struts-html.html#option
 
Andrew McLaren
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hrm, never used collections like this in Struts before, but it works like a champ!

Thanks a ton!

Andrew
 
reply
    Bookmark Topic Watch Topic
  • New Topic