You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Adam Hardy <ah...@cyberspaceroad.com> on 2007/10/11 18:19:08 UTC

static access to request / response / page context objects?

I'm writing a few static methods to use as taglib functions in my JSPs, in 
particular right now I'm writing a method to return an internationalised string 
from the resource bundles for use such as this:

<a href="/somewhere.html"
    title="${adam:message('trading.catalog.goSomewhere')}">
   Somewhere
</a>

For this example I need access to the locale in use.

I suspect that my options are to tap into the S2 framework somewhere or to set 
up a filter to store this stuff in my own ThreadLocal (which wouldn't tie me 
into any version of struts).

Any thoughts on how to achieve this?

Regards
Adam

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


Re: static access to request / response / page context objects?

Posted by Zarar Siddiqi <za...@gmail.com>.
Looks like you need a dose of ServletActionContext:

http://struts.apache.org/2.x/struts2-core/apidocs/org/apache/struts2/ServletActionContext.html

Zarar


On 10/11/07, Adam Hardy <ah...@cyberspaceroad.com> wrote:
> I'm writing a few static methods to use as taglib functions in my JSPs, in
> particular right now I'm writing a method to return an internationalised string
> from the resource bundles for use such as this:
>
> <a href="/somewhere.html"
>     title="${adam:message('trading.catalog.goSomewhere')}">
>    Somewhere
> </a>
>
> For this example I need access to the locale in use.
>
> I suspect that my options are to tap into the S2 framework somewhere or to set
> up a filter to store this stuff in my own ThreadLocal (which wouldn't tie me
> into any version of struts).
>
> Any thoughts on how to achieve this?
>
> Regards
> Adam
>
> ---------------------------------------------------------------------
> 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