首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > 软件架构设计 >

struts配置中用通配符来配置

2012-10-08 
【原创】struts配置中用通配符来配置在struts配置中,有时候我们需要写很多Forward,这样写起来其实也是很麻烦

【原创】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
使用通配符来配置即可,但这要求我们再编写的时候要特别注意名字的匹配性,这样就肯一减轻我们很多的工作。

热点排行