Professional Java Server Programming J2EE Edition
Chapter 12
Changes are made to the JSPs, and it's not necessary to rebuild the archive every time you make a change, yet
it's very easy to build the WAR when it is ready for release. To use this approach, add the following lines to
the server.xml file, which is located in the $TOMCAT_HOME/conf directory. The <Context> element is
a subelement of <ContextManager>.
<Context path="/tagext" docBase="<path to root of war>"
defaultSessionTimeOut="30" isWARExpanded="true"
isWARValidated="false" isInvokerEnabled="true"
isWorkDirPersistent="false" />
<path to root of war> will be an absolute path following the directory convention of your operating
system, and need not be under the Tomcat directory tree. I deployed this WAR on Windows NT, using
docBase="c:\ProJavaServer\Chapter12\hello". On a Unix system I might have used
docBase="/home/johnsonr/ProJavaServer/Chapter12/hello". (Note that Tomcat requires only
single backslashes for Windows paths, unlike many Java programs, which require double backslashes.) Note
the isWARExpanded attribute in the Tomcat <Context> element above.
Remember that WARs are portable. Other JSP engines will use different deployment conventions to those of
Tomcat, but the WAR itself will not change. In JRun 3.0, the deployment process is as simple, and managed
by a web interface. To deploy our application, log into the JRun Management Console (JMC), select the
desired server from the tree in the left hand frame (the JRun Default Server is the correct choice for
deployment in a new installation), and choose the WAR Deployment link. You will be prompted to select the
path to the WAR, the application name in this case, tagext and the application URL (/tagext). Once
the form is complete, press the Deploy button. When you see the message confirming successful deployment,
restart JRun (also through the JMC), and your new web application will be available. If you used the default
configuration, it will be published at http://localhost:8100/tagext/.
The following screenshot shows the JRun Management Console's WAR deployment form filled in with the
values from my system for the examples in this chapter:
New on the Java Boutique:
New Review:
Time Management Made Easy with the Quartz Enterprise Job Scheduler
Why not just use the Java timer API? This open source scheduling
API boasts simplicity, ease-of-integration, a well-rounded feature
set, and it's free!
New Applet:
Reverse Complement
Reverse Complement is a simple applet that converts DNA or RNA
sequences into three useful formats.
Elsewhere on internet.com:
WebDeveloper Java
Lots of Java information on webdeveloper.com
WDVL Java
Thorough Java resource at the Web Developer's Virtual Library.
ScriptSearch Java
Hundreds of free Java code files to download.
jGuru: Your View of the Java Universe
Customizable portal with online training, FAQs, regular news updates, and tutorials.