You are viewing a plain text version of this content. The canonical link for it is here.
Posted to taglibs-user@tomcat.apache.org by "Chaimungkalanot, Mark " <ma...@cba.com.au> on 2003/11/06 23:58:58 UTC

Usage problems with Nested EL Expressions

Guys,

I need to evaluate an EL expression that contains variables of variable
names. From the archives, it seems the way to do this is by accessing them
through the implicit objects pageScope, requestScope etc.
http://marc.theaimsgroup.com/?l=taglibs-user&m=105730468108706&w=2

However, I couldn't really get this to work. I want the value of:

<c:out value="${pageResults.sortHistory.roles.sortColumn}"/>

Which works fine, pageResults is in the request scope. So I try:

<c:set var='OBJ' value='roles'/>
<c:out value='${requestScope["pageResults.sortHistory." + OBJ +
".sortColumn"]}'/>

This gives an error "An exception occured trying to convert String
"pageResults.sortHistory." to type "java.lang.Double" (null)". So I guess my
syntax here is wrong? Strangely, even when I try:

<c:out value='${requestScope["pageResults.sortHistory.roles.sortColumn"]}'/>

This doesn't actually return anything? What am I doing wrong?

Thanks for your help!

Cheers

Mark C


**************   IMPORTANT MESSAGE  **************
This e-mail message is intended only for the addressee(s) and contains information which may be confidential. If you are not the intended recipient please advise the sender by return email, do not use or disclose the contents, and delete the message and any attachments from your system. Unless specifically indicated, this email does not constitute formal advice or commitment by the sender or the Commonwealth Bank of Australia (ABN 48 123 123 124) or its subsidiaries.
**************************************************


---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org


Re: Usage problems with Nested EL Expressions

Posted by Serge Knystautas <se...@lokitech.com>.
Chaimungkalanot, Mark wrote:
> Guys,
> 
> I need to evaluate an EL expression that contains variables of variable
> names. From the archives, it seems the way to do this is by accessing them
> through the implicit objects pageScope, requestScope etc.
> http://marc.theaimsgroup.com/?l=taglibs-user&m=105730468108706&w=2
> 
> However, I couldn't really get this to work. I want the value of:
> 
> <c:out value="${pageResults.sortHistory.roles.sortColumn}"/>
> 
> Which works fine, pageResults is in the request scope. So I try:
> 
> <c:set var='OBJ' value='roles'/>
> <c:out value='${requestScope["pageResults.sortHistory." + OBJ +
> ".sortColumn"]}'/>
> 
> This gives an error "An exception occured trying to convert String
> "pageResults.sortHistory." to type "java.lang.Double" (null)". So I guess my
> syntax here is wrong? Strangely, even when I try:
> 
> <c:out value='${requestScope["pageResults.sortHistory.roles.sortColumn"]}'/>

Do it in two stages:

<c:set var="sortColumn" 
value="${pageResults.sortHistory.roles.sortColumn}" />
<c:out value="${requestScope[sortColumn]}" />

-- 
Serge Knystautas
President
Lokitech >> software . strategy . design >> http://www.lokitech.com
p. 301.656.5501
e. sergek@lokitech.com


---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org