In this section we will download and install the Struts 2.0 on the latest version of Tomcat container. We will first download tomcat and configure it as our development server. Then we will download Struts 2.0 and install the struts-blank application on the tomcat server to check the examples that come with the struts-blank application.
Downloading Struts 2.0
Visit the Struts download site http://struts.apache.org/download.cgi and download the Struts 2.0 for this tutorial.
We have downloaded the Struts 2.0.6 (struts-2.0.6-all.zip) for this tutorial.
Download the Tomcat
Download the latest version of tomcat from http://tomcat.apache.org/download-55.cgi. We have downloaded apache-tomcat-5.5.20.zip for this tutorial.
I am assuming that latest version of Java is installed on your system. Extract downloaded file and run the C:\apache-tomcat-5.5.20\bin\startup.bat to start the tomcat. Type http://localhost:8080/ in your browser, it should show the welcome page in the browser window as shown below.
Congratulations you have now successfully installed latest version of tomcat for learning Struts 2.0. Now we will install the struts-blank application on the tomcat container and test the application.
Extracting Struts 2.0 distribution and installing on tomcat
Extract the downloaded struts distribution struts-2.0.6-all.zip into your favorite directory. To install the struts blank application copy "struts2-blank-2.0.6" from "<extracted directory>\struts-2.0.6-all\struts-2.0.6\apps" into the webapps directory of tomcat. Tomcat will automatically deploy the application.
|Feb 25, 2007 11:42:23 PM org.apache.coyote.http11.Http11BaseProtocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
Feb 25, 2007 11:42:24 PM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
Feb 25, 2007 11:42:24 PM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/141 config=null
Feb 25, 2007 11:42:24 PM org.apache.catalina.storeconfig.StoreLoader load
INFO: Find registry server-registry.xml at classpath resource
Feb 25, 2007 11:42:24 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 6672 ms
Feb 25, 2007 11:52:55 PM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive struts2-blank-2.0.6.war
To test the struts-blank application type http://localhost:8080/struts2-blank-2.0.6 in the browser and the struts-blank application get displayed in your browser window.
Click the English link and familiarize yourself with Struts Blank sample application.
Struts 2.0 distribution also contains the following sample applications that you can try:
You can simply copy these files to the webapps directory of your tomcat server. Tomcat will automatically deploy these applications and then you can test these applications.
Posted on: May 21, 2007 If you enjoyed this post then why not add us on Google+? Add us to your Circles