tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Taavi Tiirik" <ta...@ibs.ee>
Subject Re: expression that contains expression
Date Fri, 04 Jul 2003 07:44:20 GMT

Thanks, David

${pageScope[variableName]} is indeed a solution that works. Thanks
for pointing it out. It does not work though if variable contains a dot in
its name as they do in my case.

There is this article providing one solution at
http://www.mail-archive.com/taglibs-user@jakarta.apache.org/msg04616.html

It just gets too tricky. Some sort of custom tag would help but I do not
want custom tags here at this point.

Does jsp 2.0 expression language address this somehow?
${name${index}} could be quite readable and understandable I think :)

with best wishes,
Taavi


From: "David M. Karr" <dmkarr@earthlink.net>
> This isn't as clean as it could be, but now that you have a variable that
> contains the name of the variable, if you know which scope the variable is
in,
> you can then reference that scope as a HashMap, using the variable value
as the
> key.  If you don't know the scope it is in, well, we don't yet have a
"scope"
> HashMap that is a union of all of the scopes, so you could conceivable
build it
> from scratch.
>
> For instance, the scoped HashMaps are "pageScope", "requestScope",
> "sessionScope", and "applicationScope".  The reference of
> "${pageScope[variableName]}" would reference your computed variable name,
if
> you knew it was in page scope.


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


Mime
View raw message