`
yaozuodaoforfly
  • 浏览: 119062 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
社区版块
存档分类
最新评论

Wildcard-4

 
阅读更多

Parameters after the action name

To use parameters in the URL, after the action name, make sure this is set:

<constant name="struts.enable.SlashesInActionNames" value="true"/>
<constant name="struts.mapper.alwaysSelectFullNamespace" value="false"/>

Then the action mapping will look like:

<package name="edit" extends="struts-default" namespace="/edit">
    <action name="/person/*" class="org.apache.struts.webapp.example.EditAction">
        <param name="id">{1}</param>
        <result>/mainMenu.jsp</result>
    </action>   
</package>

When a URL like /edit/person/123 is requested, EditAction will be called, and its "id" field will be set to 123.

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics