RE: Using Standard Tag Library to Display a Request Attribute

2003-02-09 Thread Shawn Bayern
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:
> 
>  value="${sessionScope[sessionScope['org.apache.struts.Globals.LOCALE_KEY
> ']]}"/>
> Language = 
> 
> But all I get is an empty string. The following works, but requires an
> extra variable:
> 
> <%@ page import="org.apache.struts.Globals" %>
>  value="<%=org.apache.struts.Globals.LOCALE_KEY%>"/>
> 
> 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:
> > > 
> > >  > 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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Using Standard Tag Library to Display a Request Attribute

2003-02-09 Thread Shawn Bayern
On Sun, 9 Feb 2003, Shadow X wrote:

> What if I needed to use a key to lookup the parameter value?
> 
> For instance:
> 
>  />
> 
> "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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Using Standard Tag Library to Display a Request Attribute

2003-02-06 Thread Shawn Bayern
On Thu, 6 Feb 2003, Renick, Garrel wrote:

> 
> 
> Is there a trick to displaying request attributes with JSTL? Is the
> expression language interpreting the periods in the attribute name?

Yes, it is.  To avoid this, you can use expressions like the following:

  

The [] syntax works wherever . works, but it lets you avoid problems when
the property name itself contains a period.

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


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]