[Deployment] Tomcat 5.5, Single war into multiple apps
Joined: Mar 05, 2007
I have this foo.war created using netbeans and deployed to 2 apps in Tomcat, namely fooTest and fooProduction. So I made 2 copies and renamed them to fooTest.war and fooProduction.war and made changes to \conf\Catalina\localhost\fooTest.xml and fooProduction.xml
Both apps run fine except for links which we hardcoded in our source, like window.location = '/foo/logout.jsp'; and <img src="/foo/images/button01.gif">. Is there a way to config these apps to redirect to their corresponding subdirectory when Tomcat see path the /foo ? Any help would be great, thanks.
Joined: Feb 15, 2005
My suggestion would be to stop hardcoding the context path. It has long been a J2EE Web application best practice recommendation to avoid hardcoding the path. Just go through your application and replace every instance of /foo with <%=request.getContextPath()%>.