You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Griffith, Michael *" <Mi...@fda.hhs.gov> on 2009/04/29 21:33:45 UTC

What is wrong with my with OGNL Map expression??

Hello all, 
 
It seems as if I am always at odds with trying to figure out the correct
OGNL syntax.  I have a Map<String,String> in the HttpSession, and I'm
trying to use one of the values in the map as an anchor tag in a link.

The map is stored in the session as an attribute named
genieProperties... 

None of these expressions work...

<s:url id="myLink" anchor="#session.['genieProperties'].url" />
<s:url id="myLink" anchor="#session.genieProperties['url']" /> 
<s:url id="myLink" anchor="#session.['genieProperties['url']']" />
<s:url id="myLink" anchor="#session.['genieProperties.url']" />

Am I at least close? Any assistance would be appreciated.

Best Regards,
MG

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


Re: What is wrong with my with OGNL Map expression??

Posted by Musachy Barroso <mu...@gmail.com>.
Actually the name is Unified Expression Language, JUEL is just an
implementation of it.

musachy

On Thu, Apr 30, 2009 at 9:06 AM, Musachy Barroso <mu...@gmail.com> wrote:
> It could be a conflict with JUEL which uses "#", try the other
> notation (I think you can disable JUEL somewhere):
>
> #@java.util.LinkedHashMap@{ "foo" : "foo value", "bar" : "bar value" }
>
> musachy
>
> On Wed, Apr 29, 2009 at 3:33 PM, Griffith, Michael *
> <Mi...@fda.hhs.gov> wrote:
>> Hello all,
>>
>> It seems as if I am always at odds with trying to figure out the correct
>> OGNL syntax.  I have a Map<String,String> in the HttpSession, and I'm
>> trying to use one of the values in the map as an anchor tag in a link.
>>
>> The map is stored in the session as an attribute named
>> genieProperties...
>>
>> None of these expressions work...
>>
>> <s:url id="myLink" anchor="#session.['genieProperties'].url" />
>> <s:url id="myLink" anchor="#session.genieProperties['url']" />
>> <s:url id="myLink" anchor="#session.['genieProperties['url']']" />
>> <s:url id="myLink" anchor="#session.['genieProperties.url']" />
>>
>> Am I at least close? Any assistance would be appreciated.
>>
>> Best Regards,
>> MG
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>
>
>
> --
> "Hey you! Would you help me to carry the stone?" Pink Floyd
>



-- 
"Hey you! Would you help me to carry the stone?" Pink Floyd

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


Re: What is wrong with my with OGNL Map expression??

Posted by Musachy Barroso <mu...@gmail.com>.
It could be a conflict with JUEL which uses "#", try the other
notation (I think you can disable JUEL somewhere):

#@java.util.LinkedHashMap@{ "foo" : "foo value", "bar" : "bar value" }

musachy

On Wed, Apr 29, 2009 at 3:33 PM, Griffith, Michael *
<Mi...@fda.hhs.gov> wrote:
> Hello all,
>
> It seems as if I am always at odds with trying to figure out the correct
> OGNL syntax.  I have a Map<String,String> in the HttpSession, and I'm
> trying to use one of the values in the map as an anchor tag in a link.
>
> The map is stored in the session as an attribute named
> genieProperties...
>
> None of these expressions work...
>
> <s:url id="myLink" anchor="#session.['genieProperties'].url" />
> <s:url id="myLink" anchor="#session.genieProperties['url']" />
> <s:url id="myLink" anchor="#session.['genieProperties['url']']" />
> <s:url id="myLink" anchor="#session.['genieProperties.url']" />
>
> Am I at least close? Any assistance would be appreciated.
>
> Best Regards,
> MG
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>



-- 
"Hey you! Would you help me to carry the stone?" Pink Floyd

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


Re: What is wrong with my with OGNL Map expression??

Posted by Musachy Barroso <mu...@gmail.com>.
http://struts.apache.org/2.x/docs/debugginginterceptor.html

On Thu, Apr 30, 2009 at 10:48 AM, Musachy Barroso <mu...@gmail.com> wrote:
> if you have the debugging interceptor applied to your action, you can
> add debug=console to the url, and you will get a console where you can
> type OGNL expressions, and see the result.
>
> musachy
>
> On Thu, Apr 30, 2009 at 10:40 AM, Griffith, Michael *
> <Mi...@fda.hhs.gov> wrote:
>> Ding! Sorry I didn't see this reply earlier when I repeated how do I get
>> the map value. Again, thanks Dave!  Is there such a thing as an OGNL
>> expression validator? It would be nice to be able to fool around with
>> the expression interactively until I am able to get to the correct
>> expression.
>>
>> Cheers~
>> MG
>>
>> -----Original Message-----
>> From: Dale Newfield [mailto:dale@newfield.org]
>> Sent: Thursday, April 30, 2009 9:07 AM
>> To: Struts Users Mailing List
>> Subject: Re: What is wrong with my with OGNL Map expression??
>>
>> Michael Griffith wrote:
>>  > I have a Map<String,String> in the HttpSession  > The map is stored
>> in the session as an attribute named  > genieProperties...
>>
>> Kishan G. Chellap Paandy wrote:
>>> Assuming there's an attribute with name 'mySessionAttribute' in the
>>> Session scope <s:property value="%{#session.mySessionAttribute}" />
>>
>> Which gets you half way there.  It gets you the Map.  To get the value
>> you want from it, just call it's get method:
>>
>> <s:property value="%{#session.genieProperties.get('url')}" />
>>
>> The %{} are often left out by people, but they're critical.  That's what
>> says "this is an OGNL expression".  Musachy's response illustrates the
>> potential confusion as to what EL you're using when it's not specified.
>>
>> -Dale
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>
>
>
> --
> "Hey you! Would you help me to carry the stone?" Pink Floyd
>



-- 
"Hey you! Would you help me to carry the stone?" Pink Floyd

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


Re: What is wrong with my with OGNL Map expression??

Posted by Musachy Barroso <mu...@gmail.com>.
if you have the debugging interceptor applied to your action, you can
add debug=console to the url, and you will get a console where you can
type OGNL expressions, and see the result.

musachy

On Thu, Apr 30, 2009 at 10:40 AM, Griffith, Michael *
<Mi...@fda.hhs.gov> wrote:
> Ding! Sorry I didn't see this reply earlier when I repeated how do I get
> the map value. Again, thanks Dave!  Is there such a thing as an OGNL
> expression validator? It would be nice to be able to fool around with
> the expression interactively until I am able to get to the correct
> expression.
>
> Cheers~
> MG
>
> -----Original Message-----
> From: Dale Newfield [mailto:dale@newfield.org]
> Sent: Thursday, April 30, 2009 9:07 AM
> To: Struts Users Mailing List
> Subject: Re: What is wrong with my with OGNL Map expression??
>
> Michael Griffith wrote:
>  > I have a Map<String,String> in the HttpSession  > The map is stored
> in the session as an attribute named  > genieProperties...
>
> Kishan G. Chellap Paandy wrote:
>> Assuming there's an attribute with name 'mySessionAttribute' in the
>> Session scope <s:property value="%{#session.mySessionAttribute}" />
>
> Which gets you half way there.  It gets you the Map.  To get the value
> you want from it, just call it's get method:
>
> <s:property value="%{#session.genieProperties.get('url')}" />
>
> The %{} are often left out by people, but they're critical.  That's what
> says "this is an OGNL expression".  Musachy's response illustrates the
> potential confusion as to what EL you're using when it's not specified.
>
> -Dale
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>



-- 
"Hey you! Would you help me to carry the stone?" Pink Floyd

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


RE: What is wrong with my with OGNL Map expression??

Posted by "Griffith, Michael *" <Mi...@fda.hhs.gov>.
Ding! Sorry I didn't see this reply earlier when I repeated how do I get
the map value. Again, thanks Dave!  Is there such a thing as an OGNL
expression validator? It would be nice to be able to fool around with
the expression interactively until I am able to get to the correct
expression.

Cheers~
MG 

-----Original Message-----
From: Dale Newfield [mailto:dale@newfield.org] 
Sent: Thursday, April 30, 2009 9:07 AM
To: Struts Users Mailing List
Subject: Re: What is wrong with my with OGNL Map expression??

Michael Griffith wrote:
 > I have a Map<String,String> in the HttpSession  > The map is stored
in the session as an attribute named  > genieProperties...

Kishan G. Chellap Paandy wrote:
> Assuming there's an attribute with name 'mySessionAttribute' in the 
> Session scope <s:property value="%{#session.mySessionAttribute}" />

Which gets you half way there.  It gets you the Map.  To get the value
you want from it, just call it's get method:

<s:property value="%{#session.genieProperties.get('url')}" />

The %{} are often left out by people, but they're critical.  That's what
says "this is an OGNL expression".  Musachy's response illustrates the
potential confusion as to what EL you're using when it's not specified.

-Dale

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


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


Re: What is wrong with my with OGNL Map expression??

Posted by Zoran Avtarovski <zo...@sparecreative.com>.
Just to reiterate what Dale said, we¹ve taken to using the %{} across the
board as we were having problems with conflicts. In my experience this has
slowed my hair loss significantly.

Z.
> 
> Michael Griffith wrote:
>>  > I have a Map<String,String> in the HttpSession
>>  > The map is stored in the session as an attribute named
>>  > genieProperties...
> 
> Kishan G. Chellap Paandy wrote:
>> > Assuming there's an attribute with name 'mySessionAttribute' in the
>> > Session scope 
>> > <s:property value="%{#session.mySessionAttribute}" />
> 
> Which gets you half way there.  It gets you the Map.  To get the value
> you want from it, just call it's get method:
> 
> <s:property value="%{#session.genieProperties.get('url')}" />
> 
> The %{} are often left out by people, but they're critical.  That's what
> says "this is an OGNL expression".  Musachy's response illustrates the
> potential confusion as to what EL you're using when it's not specified.
> 
> -Dale
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 



Re: What is wrong with my with OGNL Map expression??

Posted by Dale Newfield <da...@newfield.org>.
Michael Griffith wrote:
 > I have a Map<String,String> in the HttpSession
 > The map is stored in the session as an attribute named
 > genieProperties...

Kishan G. Chellap Paandy wrote:
> Assuming there's an attribute with name 'mySessionAttribute' in the
> Session scope 
> <s:property value="%{#session.mySessionAttribute}" />

Which gets you half way there.  It gets you the Map.  To get the value 
you want from it, just call it's get method:

<s:property value="%{#session.genieProperties.get('url')}" />

The %{} are often left out by people, but they're critical.  That's what 
says "this is an OGNL expression".  Musachy's response illustrates the 
potential confusion as to what EL you're using when it's not specified.

-Dale

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


RE: What is wrong with my with OGNL Map expression??

Posted by "Griffith, Michael *" <Mi...@fda.hhs.gov>.
Assuming the attribute in the session scope is a map, how would I get
the value for the map entry called url?
 
Would it be something like this:
<s:property value="%{#session.mySessionAttribute['url']}" />

MG
-----Original Message-----
From: Kishan G. Chellap Paandy
[mailto:kishanchellapaandy_g@spanservices.com] 
Sent: Thursday, April 30, 2009 7:14 AM
To: Struts Users Mailing List
Subject: RE: What is wrong with my with OGNL Map expression??

Hi Griffith,

Assuming there's an attribute with name 'mySessionAttribute' in the
Session scope 

and you can access the same in you jsp as below:

<s:property value="%{#session.mySessionAttribute}" />

May be this will help.

Thank you.
Regards,
Kishan.G
 
Senior Software Engineer.
www.spansystems.com




-----Original Message-----
From: Griffith, Michael * [mailto:Michael.Griffith@fda.hhs.gov]
Sent: Thursday, April 30, 2009 1:04 AM
To: Struts Users Mailing List
Subject: What is wrong with my with OGNL Map expression??

Hello all, 
 
It seems as if I am always at odds with trying to figure out the correct
OGNL syntax.  I have a Map<String,String> in the HttpSession, and I'm
trying to use one of the values in the map as an anchor tag in a link.

The map is stored in the session as an attribute named
genieProperties... 

None of these expressions work...

<s:url id="myLink" anchor="#session.['genieProperties'].url" /> <s:url
id="myLink" anchor="#session.genieProperties['url']" /> <s:url
id="myLink" anchor="#session.['genieProperties['url']']" /> <s:url
id="myLink" anchor="#session.['genieProperties.url']" />

Am I at least close? Any assistance would be appreciated.

Best Regards,
MG

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


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


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


RE: What is wrong with my with OGNL Map expression??

Posted by "Kishan G. Chellap Paandy" <ki...@spanservices.com>.
Hi Griffith,

Assuming there's an attribute with name 'mySessionAttribute' in the
Session scope 

and you can access the same in you jsp as below:

<s:property value="%{#session.mySessionAttribute}" />

May be this will help.

Thank you.
Regards,
Kishan.G
 
Senior Software Engineer.
www.spansystems.com




-----Original Message-----
From: Griffith, Michael * [mailto:Michael.Griffith@fda.hhs.gov] 
Sent: Thursday, April 30, 2009 1:04 AM
To: Struts Users Mailing List
Subject: What is wrong with my with OGNL Map expression??

Hello all, 
 
It seems as if I am always at odds with trying to figure out the correct
OGNL syntax.  I have a Map<String,String> in the HttpSession, and I'm
trying to use one of the values in the map as an anchor tag in a link.

The map is stored in the session as an attribute named
genieProperties... 

None of these expressions work...

<s:url id="myLink" anchor="#session.['genieProperties'].url" />
<s:url id="myLink" anchor="#session.genieProperties['url']" /> 
<s:url id="myLink" anchor="#session.['genieProperties['url']']" />
<s:url id="myLink" anchor="#session.['genieProperties.url']" />

Am I at least close? Any assistance would be appreciated.

Best Regards,
MG

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


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