You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Dale Newfield <Da...@Newfield.org> on 2008/01/08 07:21:04 UTC

Re: [struts] getting namespace of action through OGNL

Jeromy Evans wrote:
> Wes Wannemacher wrote:
>> But, if I use the following OGNL -
>> <s:property
>> value="@com.opensymphony.xwork2.ActionContext@getContext().actionInvocation.proxy.namespace"/> 
>>
>>
>> I just get a big fat nothing :(
>
> Works for me!

Maybe it's working for both of you--Wes, are you certain that the 
appropriate answer for the page you're viewing isn't ""?  Jeromy gets 
"/secure" for the page he tested, but had he tested a different page...

-Dale

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


Re: [struts] getting namespace of action through OGNL

Posted by Jeromy Evans <je...@blueskyminds.com.au>.
Wes Wannemacher wrote:
> On Tue, 2008-01-08 at 01:21 -0500, Dale Newfield wrote:
>   
>> Jeromy Evans wrote:
>>     
>>> Wes Wannemacher wrote:
>>>       
>>>> But, if I use the following OGNL -
>>>> <s:property
>>>> value="@com.opensymphony.xwork2.ActionContext@getContext().actionInvocation.proxy.namespace"/> 
>>>>
>>>>
>>>> I just get a big fat nothing :(
>>>>         
>>> Works for me!
>>>       
>> Maybe it's working for both of you--Wes, are you certain that the 
>> appropriate answer for the page you're viewing isn't ""?  Jeromy gets 
>> "/secure" for the page he tested, but had he tested a different page...
>>     
> There have been some recent updates in SVN, so I am going to rebuild and
> redeploy. If it works as advertised in 2.0.x but not in 2.1.x I may file
> a JIRA. 
>
>   

Hi Wes, as you suspected:

struts 2.0.11: works
struts 2.1.0 (default settings): big fat nothing

But I just remembered, struts 2.1 has a new constant:

struts.ognl.allowStaticMethodAccess that's false by default.

Setting the constant to true made it work in 2.1 as well.

cheers,
 Jeromy Evans


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


Re: [struts] getting namespace of action through OGNL

Posted by Wes Wannemacher <we...@wantii.com>.
On Tue, 2008-01-08 at 01:21 -0500, Dale Newfield wrote:
> Jeromy Evans wrote:
> > Wes Wannemacher wrote:
> >> But, if I use the following OGNL -
> >> <s:property
> >> value="@com.opensymphony.xwork2.ActionContext@getContext().actionInvocation.proxy.namespace"/> 
> >>
> >>
> >> I just get a big fat nothing :(
> >
> > Works for me!
> 
> Maybe it's working for both of you--Wes, are you certain that the 
> appropriate answer for the page you're viewing isn't ""?  Jeromy gets 
> "/secure" for the page he tested, but had he tested a different page...

Yes, I am sure, in my original message I had a scriptlet that executed
and output what I wanted, but the OGNL right below it did not. I am
using the 2.1.x snapshot, so there may be an issue with it. I actually
tried a few different permutations of the OGNL code I listed and was
unable to get any results. The call to the static method 'getContext()'
returned null. The ActionContext is threadlocal so I wonder if things
maybe have changed between 2.0 / 2.1 making it unavailable within OGNL.

To be sure that Sitemesh / ActionContextCleanup weren't the issue, I had
tried it within an undecorated action too and got null.

There have been some recent updates in SVN, so I am going to rebuild and
redeploy. If it works as advertised in 2.0.x but not in 2.1.x I may file
a JIRA. 

In the meantime I worked around the issue, so my current project is
still rolling along! Thanks for the help!

-Wes


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