Webapp: mystruts-thomasma
(Web Tutorial)
by Michael Thomas
Struts Home Page
In my opinion, "Learning by Example" is the best way to learn a new
technology after you now how to install and setup the environment (ie: my "First
Steps" web docs). Having examples is also the best way to have "On
Demand" learning.
WebApp: mystruts-thomasma.war
- Example list -
This .war file (Installation Instructions below) has the following Struts
Examples:
- Struts Modules - Each example is a Struts Module. Each
module has it's own struts-config.xml & MessageResource.properties file.
Having struts modules makes team development easier, organizes the code,
and makes maintenance easier.
- Multiple struts-config.xml
- Config files - look for the multiple struts-config.xml files in the
WEB-INF directory and WEB-INF/config subdirectories.
- message-resources tag - notice how the property files are
referenced.
- action tag - notice how everything is referenced from the modules
root directory. Physically the modules directory is under the web
root directory (ie: /db/index.jsp is referenced as /index.jsp)
- web.xml - look for the references to the tag init-param and
the struts-config.xml files. This is where the module gets its
name & location for the struts-config.xml file.
- .jsp files -
- .JSP files are located in the modules which are located root
directory of the webapp.
- welcome.jsp - Notice the property "module" in the tag "html:link".
This is how you change to a new module.
- Html - launching straight HTML files.
- Properties - (under construction) using MessageResource.property files (multiple
languages etc...).
- Forms - (under construction) working with forms to collect and validate user info.
- Log - (under construction) working with log files.
- XML - (under construction) read, write, and update XML files.
- DB - (under construction) working with databases (MYSQL, ODBC, etc...)
- Reports - (under construction) creating reports.
- Upload - (under construction) uploading files.
- Install Instructions - (Tomcat & Struts)
- Download (mystruts-thomas.zip)-
download the .zip file to a temp directory.
- Extract the file mystruts-thomas.war
- Copy the file into your "webapps" directory. The Tomcat app web
server will install the web app automatically.
(Apache Projects - For instructions on
installing Tomcat and Struts)
-
http://localhost:8080/mystruts-thomasma - Test the new web app.
- Congratulations, your finished!
- Notes on Updating an existing Web App from a .WAR file.
- I would stop the "Apache Tomcat" service.
- Then delete the web app directory and working directory.
Webapps Directory: (for example)
C:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\mystruts-thomasma
Working Directory: (for example)
C:\Program Files\Apache Software Foundation\Tomcat 5.5\work\Catalina\localhost\mystruts-thomasma
- Next I would start the "Apache Tomcat" service.
- Then copy the .war file to the webapps directory.