struts2 通配符配置 action 整理

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
        "-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
        "http://struts.apache.org/dtds/struts-2.3.dtd">
<struts>
	<package name="default" namespace="/" extends="struts-default">
		<!-- listUser -->
		<action name="*_*" class="com.cml.action.{2}Action" method="{1}">
		
			<!-- when delete, add, doEdit, return "success", redirect to list{2}.jsp -->
			<result name="success" type="redirect">/list_{2}</result>
			<result name="{1}">/WEB-INF/jsp/{1}{2}.jsp</result>
		</action>
	</package>
</struts>

說明:在Action,jsp中須要有系統的命名規範,例如一個 add_User請求,其應該對應的方法爲 add, jsp文件名能夠爲 addUser.jspapache

相關文章
相關標籤/搜索