<?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>
<constant name="struts.enable.DynamicMethodInvocation" value="true" />
<constant name="struts.devMode" value="true" />
<package name="default" namespace="" extends="struts-default">
<default-action-ref name="error"></default-action-ref>
<action name="error">
<result>/error.jsp</result>
</action>
</package>
<package name="default" namespace="/" extends="struts-default">
<action name="login" class="com.test.action.LoginAction">
<result name="login_ok">/login_s.jsp</result>
<result name="login_fail">/login_f.jsp</result>
</action>
<action name="back">
<result>/login.jsp</result>
</action>
</package>
<!-- 采用通配符的写法 -->
<package name="user" namespace="/user" extends="struts-default">
<action name="*" class="com.test.action.UserAction" method="{1}">
<result>/user/add.jsp</result>
</action>
</package>
<package name="admin" namespace="/admin" extends="struts-default">
<action name="login" class="com.test.action.AdminAction">
<result>/admin/index.jsp</result>
</action>
<!-- 动态调用 -->
<action name="admin" class="com.test.action.AdminAction">
<result>/admin/add.jsp</result>
</action>
<!--
<action name="add" class="com.test.action.AdminAction" method="add">
<result>/admin/add.jsp</result>
</action>
-->
</package>
<!-- Add packages here -->
</struts>
如例子所示,在user中就是采用了通配符的写法。