struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ted Husted" <>
Subject Re: getting namespace of action through OGNL
Date Mon, 07 Jan 2008 20:20:21 GMT
The Action (or an Interceptor) could set it as a property that a tag
could then access.

We can set properties directly to the stack from an Interceptor. (This
is how the validators expose bad input to a typed field.)

As a general rule, pages should be as dumb as possible, and only know
what the value stack tells it.

Note that the value stack properties are exposed as request
properties, so any property set should be available to the tags and
JSTL without any weird OGNL syntax.

HTH, Ted
 * <>

On Jan 7, 2008 2:36 PM, Wes Wannemacher <> wrote:
> Hello,
> I have been struggling to find a way to see what the namespace is from
> within a JSP. So, from the view, I would like to know what the namespace
> is of the action that was called.
> The following scriptlet correctly returns the namespace -
> <%
> com.opensymphony.xwork2.ActionContext ac =
> com.opensymphony.xwork2.ActionContext.getContext();
> com.opensymphony.xwork2.ActionInvocation invo =
> ac.getActionInvocation();
> com.opensymphony.xwork2.ActionProxy proxy = invo.getProxy();
> out.println(proxy.getNamespace());
> %>
> 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 :(
> I am open to any suggestions, I just want to know what namespace is... I
> don't really want to parse the requested URL. If I can't figure it out
> in OGNL, I will probably write an interceptor to put the value somewhere
> that I can read it in OGNL. Before I write the interceptor through, I
> figured I would ask here since I might be doing something blatantly
> wrong.
> Thanks!
> -Wes

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message