aspose file tools*
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 Soft Skills this week in the Jobs Discussion 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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: access to the context path w/in Action class