Detailed explanation of struts.xml configuration

1) Action mapping refers to:
specify the method of action execution in struts.xml, such as: <action name="findgoodstype" class="com.myStruts.web.action.GoodsTypeAction" method="findGoodsType">
One: name= "findgoodstype" is the name used when calling the action, and the calling method is: findgoodstype.action.
Two: class="com.myStruts.web.action.GoodsTypeAction" is the java file to be directed to. The premise is to ensure that there is a GoodsTypeAction.java file in the com.myStruts.web.action package directory structure.
Three: method="findGoodsType" is the method to be executed by the action. The premise is to ensure that there must be a method named findGoodsType in the GoodsTypeAction.java file.
2) Pass parameters in Action:
<action name="findgoodstype" class="com.myStruts.web.action.GoodsTypeAction" method="findGoodsType">
<param name="kind">child</param>
</action>
where param name="
3) Jump to the corresponding page:
<action name="findgoodstype" class="com.myStruts.web.action.GoodsTypeAction" method="findGoodsType">
<param name="kind">child</param>
<result name ="goodstype">stype.jsp</result>
</action>
where the goodstype in result name="goodstype" is the return value of the findGoodsType method, which can be implemented by return "findGoodsType";, and stype.jsp is to jump to jsp page.

There are many ways to configure the struts.xml file, the above are just the commonly used ones.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326593172&siteId=291194637