2012-03-15 21:07:15.0|分类: struts|浏览量: 1583
<action name="Logon" class="tutorial.Logon"> <result type="redirectAction">Menu</result> <result name="input">/Logon.jsp</result> </action>
注:(1)在web项目中,匹配action时,去掉请求路径中的host和项目的名字,只匹配name In a web application, the name attribute is matched as part of the location requested by a browser (or other HTTP client). The framework will drop the host and application name and the extension and match what's in the middle: the action name. So, a request for http://www.planetstruts.org/struts2-mailreader/Login.do will map to the Logon action.
(2)使用Struts标签时,form中可以直接写action的name Within an application a link to an action is usually generated by a Struts Tag. The tag can specify the action by name, and the framework will render the default extension and anything else that is needed. Forms may also submit directly to a Struts Action name (rather than a "raw" URI). (3)如果action中会出现“/”,需要配置 <constant name="struts.enable.SlashesInActionNames" value="true"/> Action Names With Slashes If your action names have slashes in them (for example, <action name="admin/home" class="tutorial.Admin"/>) you need to specifically allow slashes in your action names via a constant in thestruts.xml file by specifying <constant name="struts.enable.SlashesInActionNames" value="true"/>. (4)action的name使用驼峰表示 Action Names with Dots and Dashes |