• 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
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

JSP 2.0 EL and html:options issue

 
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

It might be simple but I couldn't figure it out ..

I have a jsp in which I have the following code

<html:select property="svenv">
<html ption value="0">(any)</html ption>
<c:forEach var='se' items='${sessionScope.UserInfo.svenv}'>
<html ption value="<c ut value='${se}'/>"><c ut value='${se}'/></html ption>
</c:forEach>
</html:select>


if I invoke the jsp and see the source code

select name="svenv"><option value="0">(any)</option>

<option value="<c ut value='${se}'/>">Save</option>



<option value="<c ut value='${se}'/>">Print</option></select>

Is there anything wrong in giving

<html ption value="<c ut value='${se}'/>"> ?

My problem is value attribute does not have Save or Print . I don't know what I am missing ..please shed some light
 
Sheriff
Posts: 67752
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can't use custom tags in the attribute values of other custom tags.
[ December 28, 2005: Message edited by: Bear Bibeault ]
 
Bartender
Posts: 1845
10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you have a JSP2.0 container, you can use EL expressions in the html:option tag
<c:forEach var='se' items='${sessionScope.UserInfo.svenv}'>
<html:option value="${se}"><c:out value='${se}'/></html:option>
</c:forEach>

Alternatively use the html:options tag rather than the c:forEach tag, but I'm not sure if you can use it with a collection of strings.
I think it would be something like this,
<html:options name="UserInfo" property="svenv"/>

That is starting to branch off into struts territory though.
 
There are 29 Knuts in one Sickle, and 17 Sickles make up a Galleon. 42 tiny ads in a knut:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic