struts2通配符

<struts> 
  <package name="sshweb" extends="struts-default" namespace="/common"> 
  <action name="*_*" class="{1}" method="{2}" > 
  <result>/pages/{1}.jsp</result> 
  <result name="input" >/jsp/{1}.jsp</result> 
  <result name="C0101001" type="redirectAction">C0101001_execute</result> 
  <result name="C0101002" type="redirectAction">C0101002_execute</result> 
  <result name="C0101003" type="redirectAction">C0101003_execute</result> 
  <result name="C0101004" type="redirectAction">C0101004_execute</result> 
  <result name="C0101005" type="redirectAction">C0101005_execute</result> 
  </action> 
  </package> 
</struts> 

说明:路径/TestAction_getMessage请求会交给 TestAction类的 getMessage方法去处理 

或 

<package name="user" extends="struts-default" namespace="/"> 
<action name="user_*" class="com.test.action.UserAction" method="{1}"> 
<result>/user_{1}.jsp</result> 
</action> 
</package> 

你可能感兴趣的:(struts,通配符)