To create a Web application and a struts framework configuration file instance

Source: Internet
Author: User
Tags tld

Create a configuration file for a Web application

For struts applications, its configuration file web.xml should be configured for the Actionservlet class, and the Struts tag library used by Web applications should be declared, in this case, three tag libraries are declared: Struts Bean, struts HTML and Struts logic tag library. Routine 1 is the source code for the Web.xml.

Routine 1 Web.xml

<?xml version= "1.0" encoding= "UTF-8"
<! DOCTYPE web-app
Public "-//sun Microsystems, INC.//DTD Web application 2.2//en"
"http://java.sun.com/j2ee/dtds/ Web-app_2_2.dtd "
<web-app>
<display-name>helloapp Struts application</display-name>
<!--Standard Action Servlet Configuration
<servlet>
<servlet-name>action</ Servlet-name>
<servlet-class>org.apache.struts.action.actionservlet</servlet-class>
< Init-param>
<param-name>config</param-name>
<param-value>/web-inf/struts-config.xml </param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</ Servlet>
<!--Standard Action Servlet Mapping
<servlet-mapping>
<servlet-name> Action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
< !--the usual Welcome File List--
<welcome-file-list>
<welcome-file>hello.jsp</welcome-file>
</ Welcome-file-list>
<!--Struts Tag Library descriptors;
<taglib>
<taglib-uri>/ Web-inf/struts-bean.tld</taglib-uri>
<taglib-location>/web-inf/struts-bean.tld</ Taglib-location>
</taglib>
<taglib>
<taglib-uri>/web-inf/struts-html.tld</ Taglib-uri>
<taglib-location>/web-inf/struts-html.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/web-inf/struts-logic.tld</taglib-uri>
<taglib-location >/web-inf/struts-logic.tld</taglib-location>
</taglib>
</web-app>

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.