struts-user mailing list archives

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

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.


Sébastien Domergue

Markus Demetz <> 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:
> For additional commands, e-mail:

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

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

View raw message