Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

html:option woes

 
Andrew McLaren
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • 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 ]
 
Stefan Evans
Bartender
Pie
Posts: 1671
10
  • Mark post as helpful
  • send pies
  • 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 <htmlption>, the better approach would be to use either the <htmlptions> tag or the <htmlptionsCollection> 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
  • Quote
  • Report post to moderator
Hrm, never used collections like this in Struts before, but it works like a champ!

Thanks a ton!

Andrew
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic