Summarize:
The name of the package in Struts.xml can be arbitrarily defined and used only for inheritance.
<package name= "..." abstract= "true" >
The package cannot have an action definition and can only be defined by package inheritance.
In order to make the program easy and quick to use, it is necessary to learn the path dynamic calling code of struts as follows:
<action name= "a_*" class= "Action.submit" method= "{1}" > <result name= "{1}" >/{1}.jsp</result ></action>
This way, you can automatically find the specified method in the Java class
Public String A () { system.out.print ("1"); Return "a";}
<a href= "A_a" ></a>
Precautions:
This method requires a JSP page, a method in Java, and the return value of a method in Java, which must be the same.
If not, 404 of these errors will occur frequently.
Also note that custom form fields have duplicate names.
Experience Summary:
Filterdispatcher-----Core Controller
Each action-------Business controller
<s:fielderror cssstyle= "color:red" >
<S:param>username</s:param>
</s:fielderror>
Remove the previous "origin", you need to modify the FIELDERROR.FTL template, remove the previous point code
When writing struts2, in return, remember that SUCCESS is defined in action, which is a constant, if written as a string literal of "SUCCESS". If you write a string literal, you need to <resutl name= "your string literal" >xxx.jsp or xxx.html</result>
JSP page to be added at the beginning: <%@ taglib prefix= "s" uri= "/struts-tags"%>
About displaying HTML-formatted content in <s:property value= "xx"/>. Use the Escape property to determine whether to parse HTML-formatted content.
Struts Experience (II.)