struts2 Action可以用通配符命名,想知道怎么样配置最省事,不至于写死
1、是不是跳转页面都要通过ACTION来处理?
2、本来打算用这种模式
struts2 Action可以用通配符命名,想知道怎么样配置最省事,不至于写死
1、是不是跳转页面都要通过ACTION来处理?
2、本来打算用这种模式
好。大致明白了。
一个是提交到addUser.jsp的action,一个是从addUser.jsp提交到别的页面的action。
我给你重新命名一下:
name="addInfo_user" class="com.xx.UserAction" method="addInfo">
/addInfoUser.jsp
name="add_user" class="com.xx.UserAction" method="add">
/addResult.jsp
把其中的几个变化一下:
name="*_user" class="com.xx.UserAction" method="{1}">
/{1}User.jsp
name="*_user" class="com.xx.UserAction" method="{1}">
/{1}Result.jsp
你看这样行不行?
我想了一下,如果这两个action都调用同一个action中的不同的两个方法,其实你就没必要用通配符了。假如你要调用同一个action类中的不同方法的时候,这样可以用的通配符,很方便。