Beginner structs Configuration and its precautions

Source: Internet
Author: User

just beginning to contact structs, configuration process and its various errors, for a long time, in order to prevent later forget again, so here is a simple record.

First, create a new Web project, import the jar package under the Web , and then configure Struct.xml with the following code:

<?XML version= "1.0" encoding= "UTF-8"?><!DOCTYPE struts Public "-//apache software foundation//dtd struts Configuration 2.3//en" "Http://struts.apache.or G/dtds/struts-2.3.dtd "><Struts><constantvalue= "false"name= "Struts.enable.DynamicMethodInvocation"/><constantvalue= "true"name= "Struts.devmode"/>    < Packagename= "Struts2"extends= "Struts-default"namespace="/">        <Actionname= "Login"class= "Net.hncu.struct2.action.LoginAction"><!--Note here that the action name= "Login", which is generally uppercase, is intended to be <form action= "login.action" > Relative to the main page of the back-side--! >            <resultname= "Success">/login_success.jsp</result><!--here to jump to the next page!-->            <resultname= "Failure">/login_failure.jsp</result>        </Action>    </ Package></Struts>

Then configure Web. XML with the following code:

<filter><filter-name>struts2</filter-name><filter-class> org.apache.struts2.dispatcher.ng.filter.strutsprepareandexecutefilter</filter-class></filter>< filter-mapping><filter-name>struts2</filter-name><url-pattern>/*</url-pattern></ Filter-mapping><welcome-file-list><welcome-file>login.jsp</welcome-file>

Copy the code here to the Web. XML and complete the configuration

Beginner structs Configuration and its precautions

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.