Adding Struts to an Existing Web Application
from
http://www.coreservlets.com/Apache-Struts-Tutorial/By far the easiest way to develop a Struts application is to start with struts-blank, rename it, and work from there. If that approach is an option for you, do it that way and skip this section. However, if you already have an existing Web application and want to add Struts capabilities to it, starting with struts-blank won't work. Adding Struts capabilities to existing Web apps is a huge pain in the neck, and will proably require several attempts to get it right. Here is a quick summary:
- Copy JAR files from struts-blank/WEB-INF/lib to your_web_app/WEB-INF/lib.
- Copy TLD files from struts-blank/WEB-INF to your_web_app/WEB-INF.
- Copy struts-config.xml from struts-blank/WEB-INF to your_web_app/WEB-INF.
- Copy the application properties file from struts-blank/WEB-INF/classes/resources to your_web_app/WEB-INF/classes/resources.
- If you plan on using the automatic validator copy validation.xml and validator-rules.xml from struts-blank/WEB-INF to your_web_app/WEB-INF.
- If you plan on using Tiles copy struts-tiles.xml from struts-blank/WEB-INF to your_web_app/WEB-INF.
- Copy declarations out of struts-blank/WEB-INF/web.xml into your_web_app/WEB-INF/web.xml. Most importantly, copy the
servlet
and servlet-mapping
entries that map *.do to org.apache.struts.action.ActionServlet
. Be sure you keep the entries in the same locations: the order of elements in web.xml matters.