`
oritenson
  • 浏览: 14031 次
  • 性别: Icon_minigender_1
  • 来自: 大连
社区版块
存档分类
最新评论

【原创】struts配置中用通配符来配置

阅读更多

在struts配置中,有时候我们需要写很多Forward,这样写起来其实也是很麻烦的,那么有没有更好的办法呢?当然有了,struts官方已经提供了案例:

<!-- Generic edit* mapping -->
<action
    path="/edit*"
    type="org.apache.struts.webapp.example.Edit{1}Action"
    name="{1}Form"
    scope="request"
    validate="false">
    <forward
        name="failure"
        path="/mainMenu.jsp"/>
    <forward
        name="success"
        path="/{1}.jsp"/>
</action>

链接:http://struts.apache.org/1.x/userGuide/building_controller.html
使用通配符来配置即可,但这要求我们再编写的时候要特别注意名字的匹配性,这样就肯一减轻我们很多的工作。
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics