• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

[Deployment] Tomcat 5.5, Single war into multiple apps

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear experts,

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

<?xml version="1.0" encoding="UTF-8"?>
<Context path="/fooTest" reloadable="true">
<ResourceLink global="jdbc/fooTestDB" name="jdbc/fooTestDB" type="javax.sql.DataSource"/>
</Context>

<?xml version="1.0" encoding="UTF-8"?>
<Context path="/fooProduction" reloadable="true">
<ResourceLink global="jdbc/fooProductionDB" name="jdbc/fooProductionDB" type="javax.sql.DataSource"/>
</Context>

So we have 2 apps which can be accessed from
http://localhost:8080/fooTest and
http://localhost:8080/fooProduction

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.
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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()%>.
 
Eugene Wong
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Merrill for your suggestion.
 
reply
    Bookmark Topic Watch Topic
  • New Topic