Skip to Main Content
Jakarta Struts Cookbook
book

Jakarta Struts Cookbook

by Bill Siggelkow
February 2005
Intermediate to advanced content levelIntermediate to advanced
528 pages
12h 53m
English
O'Reilly Media, Inc.
Content preview from Jakarta Struts Cookbook

13.1. Deploying an Application Automatically

Problem

You want to be able to test and retest your web application in Tomcat without having to redeploy the application whenever a change is made to a Java class or JSP page.

Solution

Use the development directories of your application as the actual directories that the application server uses for the deployed application. For Tomcat, you would create a Context element immediately before the </Host> end tag in the conf/server.xml file (under your CATALINA_HOME top-level directory).

<Host...>
   ...
   <Context path="/struts-cookbook" 
         docBase="/path/to/myapp/web"
      reloadable="true"/>
</Host>

Discussion

This recipe is not particular to Struts but is applicable to any J2EE-based web applications. However, the Solution is particular to Tomcat. If you aren't using Tomcat, your application server most likely uses a similar mechanism. If you use the Solution, you won't have to deploy your application when changes are made; your application will always be deployed.

The docBase attribute specifies a file path to your deployment directory. If you're using Windows, you'll need to include the drive letter on the path as shown here:

docBase="c:/Documents and Settings/My App/web"

The structure of this directory must match the structure of a valid J2EE web application. Its contents would look something like this:

/index.html /welcome.jsp /feedback.jsp /images/banner.gif /WEB-INF/web.xml /WEB-INF/struts-config.xml /WEB-INF/classes/ApplicationResources.properties /WEB-INF/classes/com/foo/MyBar.class ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Programming Jakarta Struts

Programming Jakarta Struts

Chuck Cavaness
Beginning Spring Framework 2

Beginning Spring Framework 2

Bruce Snyder, Sing Li, Anne Horton, Thomas Van de Velde, Naveen Balani, Christian Dupuis
Java Cookbook

Java Cookbook

Ian F. Darwin
Struts 2 in Action

Struts 2 in Action

J. Scott Stanlick, Chad Michael Davis, Donald J. Brown

Publisher Resources

ISBN: 059600771XSupplemental ContentErrata Page