aspose file tools*
The moose likes Struts and the fly likes How to set default Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "How to set default "Context Root" for all urls in the webapp?" Watch "How to set default "Context Root" for all urls in the webapp?" New topic
Author

How to set default "Context Root" for all urls in the webapp?

Srini Venkata
Greenhorn

Joined: Apr 06, 2009
Posts: 1
Hello,
I recently started working in a project where tomcat is being used.

=============
and under tomcat/conf/Catalina/localhost directory there is a myContext.xml file which had

<Context docBase="xxxxx/tomcat/webapps/myContext" path="/myContext"></Context>

----------
and in the same tomcat/conf/Catalina/localhost directory there is a ROOT.xml file which had
<Context docBase="acuscreen" path="">
-----
I believe now, that the myContext.xml file is never used but only ROOT.xml file is used and because path="", no context path was ever used in the urls.
==============


and all urls inside the application did not have the "context path" in them.

On my local development server, i installed tomcat and i have used myContext as my context root and it is in server.xml as

<Context docBase="myContext" path="/myContext" reloadable="true" source="org.eclipse.jst.j2ee.server:myContext"/>

and because none of the urls in the application have "context path" in them, iam getting "The requested resource (/xxx.do) is not available."

I believe that if i add context path to that url it would work, but is there a way that i can direct requests from all urls via this default context path without actually appending the context path to those urls in the code.

If it helps,Struts 1.2 is used.

Thanks much.

------------------

I could figure out now that if i changed the path="" in server.xml file on my local system, no context path would be needed and so no need to change the urls in the existing application.

Thanks

David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

This should be posted in a servlet or tomcat forum since it's not directly related to Struts.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to set default "Context Root" for all urls in the webapp?