[size=medium]
在struts配置中,有时候我们需要写很多Forward,这样写起来其实也是很麻烦的,那么有没有更好的办法呢?当然有了,struts官方已经提供了案例:
[color=red]
<!-- 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>
[/color]
链接:http://struts.apache.org/1.x/userGuide/building_controller.html
使用通配符来配置即可,但这要求我们再编写的时候要特别注意名字的匹配性,这样就肯一减轻我们很多的工作。
[/size]
在struts配置中,有时候我们需要写很多Forward,这样写起来其实也是很麻烦的,那么有没有更好的办法呢?当然有了,struts官方已经提供了案例:
[color=red]
<!-- 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>
[/color]
链接:http://struts.apache.org/1.x/userGuide/building_controller.html
使用通配符来配置即可,但这要求我们再编写的时候要特别注意名字的匹配性,这样就肯一减轻我们很多的工作。
[/size]