通过格式:actionName!methodName.action
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
"http://struts.apache.org/dtds/struts-2.5.dtd">
<struts>
<constant name="struts.devMode" value="true" />
<constant name="struts.enable.DynamicMethodInvocation" value="true" />
<package name="default" extends="struts-default" namespace="/">
<action name="userInfo" class="UserInfoAction" method="execute">
<result name="success">success.jsp</result>
<result name="error">error.jsp</result>
<result name="doit">success.jsp</result>
<allowed-methods>doit</allowed-methods>
</action>
</package>
</struts>
通过指定方法:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
"http://struts.apache.org/dtds/struts-2.5.dtd">
<struts>
<package name="nhf" extends="struts-default" namespace="/nhfc99">
<action name="nhf" class="com.nhfc99.actions.NhfAction" method="execute">
<result name="success">${pageContext.request.contextPath}/success.jsp
</result>
<result name="deal">${pageContext.request.contextPath}/method/deal.jsp
</result>
<allowed-methods>deal</allowed-methods>
</action>
<action name="edit" class="com.nhfc99.actions.NhfAction"
method="edit">
<result name="edit">${pageContext.request.contextPath}/method/edit.jsp
</result>
</action>
</package>
</struts>
网友评论