Beginner JSP: Configure the first Struts configuration process

Source: Internet
Author: User
Tags config version tld

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>



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.