This article is focused on some of the experience of JSP programming enthusiasts learning struts, how to configure the struts process a simple exercise.
First download the struts package, to the http://struts.apache.org/download struts,struts version of the difference is very large, here has been Struts1.2.9 version for example, unpack the contents of the package as follows:
1. Create a WEBJX directory in the WebApps directory under the Tomcat installation directory. This allows access to the "WEBJX" directory by accessing "HTTP://LOCALHOST:8080/WEBJX".
2, in the directory you create WEBJX, set up Web-inf directory, in Web-inf to establish classes, Lib and TLD folder. Copies the Commons-*.jar (* representing arbitrary characters) and Struts.jar files in the compressed Package Struts-1.2.9-binlib folder to the established Webjx/web-inf/lib directory. Then copy the tag library file Struts-*.tld (* representing any character) in struts to the WEBJX/WEB-INF/TLD directory
3, in the webjx/web-inf/directory to establish a Web.xml file, the contents of the document are as follows:
<?xmlversion= "1.0" encoding= "Iso-8859-1"?>
<! Doctypeweb-app
Public "-//sunmicrosystems,inc.//dtdwebapplication2.2//en"
"Http://java.sun.com/j2ee/dtds/web-app_2_3.dtd" >
<web-app>
<display-name>StrutsBlankApplication</display-name>
<!--standardactionservletconfiguration (withdebugging)-->
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<init-param>
<param-name>application</param-name>
<param-value>ApplicationResources</param-value>
</init-param>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
<init-param>
<param-name>debug</param-name>
<param-value>2</param-value>
</init-param>
<init-param>
<param-name>detail</param-name>
<param-value>2</param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>
<!--standardactionservletmapping-->
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
<!--theusualwelcomefilelist-->
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<!--strutstaglibrarydescriptors-->
<taglib>
<taglib-uri>/tags/struts-bean</taglib-uri>
<taglib-location>/WEB-INF/tld/struts-bean.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/tags/struts-html</taglib-uri>
<taglib-location>/WEB-INF/tld/struts-html.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/tags/struts-logic</taglib-uri>
<taglib-location>/WEB-INF/tld/struts-logic.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/tags/struts-nested</taglib-uri>
<taglib-location>/WEB-INF/tld/struts-nested.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/tags/struts-tiles</taglib-uri>
<taglib-location>/WEB-INF/tld/struts-tiles.tld</taglib-location>
</taglib>
</web-app>