wood burning stoves 2.0*
The moose likes Struts and the fly likes access to the context path w/in Action class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "access to the context path w/in Action class" Watch "access to the context path w/in Action class" New topic
Author

access to the context path w/in Action class

J. Cartwright
Greenhorn

Joined: Sep 27, 2004
Posts: 16
Hello All,

is there a way to access the context path w/in the Action class? I'd like the equivilent of the the JSP tag:

<html:rewrite page=""/>

Thanks!

-- john
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
To get the context path:

String path = request.getContextPath();

To perform URL rewriting:

String newURL = response.encodeUrl(oldUrl);


Merrill
Consultant, Sima Solutions
 
jQuery in Action, 2nd edition
 
subject: access to the context path w/in Action class
 
Similar Threads
web application (mvc using jsp and servelet)
requested resource not found error
Can I access the Application Context from a Struts 2 Action?
embedded js file in doGet
Trouble in hitting servlet via Hyperlink