tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shawn Bayern <bay...@essentially.net>
Subject RE: Using Standard Tag Library to Display a Request Attribute
Date Mon, 10 Feb 2003 02:01:13 GMT
No, but that's only because 'org.apache.struts.Globals' isn't a scoped
variable; the expression language can't be used to retrieve static fields
in a class.  The expression language is designed to access only certain
kinds of data.

-- 
Shawn Bayern
"JSTL in Action"   http://www.manning.com/bayern

On Sun, 9 Feb 2003, Shadow X wrote:

> I tried the nesting of [] but it doesn't seem to work.
> 
> Perhaps I should make my situation clearer.  I've saved the locale
> object under the key org.apache.struts.Globals.LOCALE_KEY  (with
> setLocale(request,locale) in struts)
> 
> Now in my jsp I want to retrieve the locale. I tried:
> 
> <c:set scope="page" var="lo"
> value="${sessionScope[sessionScope['org.apache.struts.Globals.LOCALE_KEY
> ']]}"/>
> Language = <c:out value="${pageScope.lo.language}" />
> 
> But all I get is an empty string. The following works, but requires an
> extra variable:
> 
> <%@ page import="org.apache.struts.Globals" %>
> <c_rt:set var="locale_key"
> value="<%=org.apache.struts.Globals.LOCALE_KEY%>"/>
> <c:set scope="page" var="locale" value="${sessionScope[locale_key]}"/>
> Language= <c:out value="${pageScope.locale.language}"/>
> 
> I was wondering if there was a way to do it without using a runtime
> expression and an extra variable.
> 
> Thanx for your time.
> 
>  ~Shadow
> 
> > On Sun, 9 Feb 2003, Shadow X wrote:
> > 
> > > What if I needed to use a key to lookup the parameter value?
> > > 
> > > For instance:
> > > 
> > > <c:out 
> > value="${requestScope['org.apache.struts.Globals.LOCALE_KEY']}"
> > > />
> > > 
> > > "org.apache.struts.Globals.LOCALE_KEY" actually maps to 
> > > "org.apache.struts.action.LOCALE"
> > 
> > If I'm understanding the request right, the following would work:
> > 
> >  ${requestScope[requestScope['org.apache.struts.Globals.LOCALE_KEY']]}
> > 
> > -- 
> > Shawn Bayern
> > "JSTL in Action"   http://www.manning.com/bayern
> > 
> 
> 


---------------------------------------------------------------------
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