wood burning stoves 2.0*
The moose likes Struts and the fly likes html:option woes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "html:option woes" Watch "html:option woes" New topic
Author

html:option woes

Andrew McLaren
Ranch Hand

Joined: May 27, 2005
Posts: 33
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

Joined: Jul 06, 2005
Posts: 1016
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

Joined: May 27, 2005
Posts: 33
Hrm, never used collections like this in Struts before, but it works like a champ!

Thanks a ton!

Andrew
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: html:option woes
 
Similar Threads
Pass selected bean property to javascript
Dynamically displaying html:option values
HTML:SELECT
using c:out in a href and html:select
nested struts tags