Meaningless Drivel is fun!*
The moose likes JSP and the fly likes JSP 2.0  EL  and html:options issue Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "JSP 2.0  EL  and html:options issue" Watch "JSP 2.0  EL  and html:options issue" New topic
Author

JSP 2.0 EL and html:options issue

Sri Ram
Ranch Hand

Joined: Sep 08, 2002
Posts: 48
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
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61095
    
  66

You can't use custom tags in the attribute values of other custom tags.
[ December 28, 2005: Message edited by: Bear Bibeault ]

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Stefan Evans
Bartender

Joined: Jul 06, 2005
Posts: 1018
If you have a JSP2.0 container, you can use EL expressions in the htmlption tag
<c:forEach var='se' items='${sessionScope.UserInfo.svenv}'>
<htmlption value="${se}"><cut value='${se}'/></htmlption>
</c:forEach>

Alternatively use the htmlptions 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,
<htmlptions name="UserInfo" property="svenv"/>

That is starting to branch off into struts territory though.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JSP 2.0 EL and html:options issue