As the most popular Web framework, getting started with Struts may be quite troublesome. It takes me a whole day to get him started successfully. The results are as follows:
Example requirements:
1. allow the user to enter a name and return "Hello XXX!" after submission !", Output Format: Hello <Name> string
2. If the user does not enter a name, an error message is returned.
3. When the name entered by the user carries the "," symbol, an error message is prompted, that is, the name containing the "," symbol cannot be entered.
Running environment of the example:
Windows2000, jdk1.4.2, tomcat5.0, and struts1.2
Tomcat and struts
Preparations:
1. Create the struts directory under Tomcat 5.0/webapps/directory, which contains the WEB-INF directory and hello. jsp file
2. Create the classes directory, lib directory, WEB-INF file, Web. xml file under Tomcat 5.0/webapps/struts/struts-config.xml/directory
3. Copy the struts Runtime Library to the Tomcat 5.0/webapps/struts/WEB-INF/lib/directory.
Including: anlr. jar, commons-beanutils.jar, commons-collections.jar, commons-digester.jar, commons-fileupload.jar, commons-logging.jar, commons-validator.jar, jakarta-oro.jar, Struts. jar, struts-bean.tld, struts-html.tld, struts-logic.tld
Some files may not be used in this example, but we recommend that you copy them all to save trouble :)