struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From DOMERGUE Sebastien <sebastien.domer...@c-s.fr>
Subject Re: Access namespace-name or/and action name from jsp in Struts2
Date Tue, 11 Oct 2011 17:44:42 GMT
Hi,

first of all, you won't be able to access these directly within the  
jsp. In your action (or in a interceptor), you have to access the  
request (you can use ServletActionContext for instance). Then, with  
this object you can obtain the url, the server name, the uri... A few  
substrings later, you'll have your namespace and action name. Then,  
put it in the response in order to manipulate them in the jsp.
There may be a more beautifull but this one works for me in several projects.

Regards

Sébastien Domergue

Markus Demetz <markus@demetz.eu> a écrit :

> Hi,
>
> I would like to retrieve the name of the current namespace and  
> possibly the action from the jsp page using Struts2.
> My intention is to assign a css class to a container to have a  
> better control of the layout.
>
> e.g.
>
> <div id="maincontainter" class="current-namespace">...</div>
>
> Any hints?
> Thank you,
> Markus
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>



----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.



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


Mime
View raw message