动作方法 | 描述 | 下一个动作方法 |
---|---|---|
add | 为save准备网页 | save |
save | 提交INSERT | list |
edit | 为update准备网页 | update |
update | 提交UPDATE | list |
destroy | 为remove准备网页 | remove |
remove | 提交DELETE | list |
show | 为详细展示准备网页 | list |
list | 为列表展示准备网页 | list |
为打印准备网页 | list |
一个动作类的DEMO:
package com.bankmetal.action; public class DemoAction { public String add(){ ... return ADD; } public String save(){ ... return SAVE; } public String edit(){ ... return EDIT; } public String update(){ ... return UPDATE; } public String destroy(){ ... return DESTROY; } public String remove(){ ... return REMOVE; } public String show(){ ... return SHOW; } public String list(){ ... return LIST; } public String print(){ ... return PRINT; } }
一个struts.xml的DEMO:
<action name="*-*" method="{2}" class="DemoAction"> <result name="add">/pages/{1}/add.jsp</result> <result name="save">/pages/{1}/save.jsp</result> <result name="edit">/pages/{1}/edit.jsp</result> <result name="update">/pages/{1}/update.jsp</result> <result name="destroy">/pages/{1}/destroy.jsp</result> <result name="remove">/pages/{1}/remove.jsp</result> <result name="show">/pages/{1}/show.jsp</result> <result name="list">/pages/{1}/list.jsp</result> <result name="print">/pages/{1}/print.jsp</result> </action>
struts2 通配符简化配置,布布扣,bubuko.com
原文:http://blog.csdn.net/coslay/article/details/32732067