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