/**
* 万用转发Action
* 使用其代替直接写指向jsp的URL。这样可以统一控制权限等操作。
* 调用方法:/dispatch.action?target=dic/dic-frame
* 表示此次调用的目标页面是:/dic/dic-frame.jsp
*
*@author oldbig
*/
@Controller
@Scope("prototype")
@ParentPackage("my-default")
@Namespace("/")
public class DispatchAction extends _BaseAction {
private String target;
@Action(results={@Result(name = "success", location="/${target}.jsp") })
public String execute() throws Exception {
return SUCCESS;
}
/**
* @return the target
*/
public String getTarget() {
return target;
}
/**
* @param target the target to set
*/
public void setTarget(String target) {
this.target = target;
}
注意: my-default继承struts-default,里面包含了一些拦截器,比如权限检查等等。
-----------------------------
By the way:
一杯茶从早泡到晚的做法不可取。
分享到:
相关推荐
struts2一个action处理多个请求
资源中示例了一个struts2的配置文件中配置的action的result结果为另外一个action的配置,该跳转的过程中是带所有参赛调整的,在另外一个action中可以接受到当前action的所有参数,此配置文件是我日常开发中的经验...
利用Struts 2框架创建一个web项目chap2_e22,实现用户登录过程。具体要求是在loginAction类中分别用login()和registered()处理用户登录和注册的过程,分别创建login.jsp和register.jsp两个页面实现登录和注册的...
Struts 2实战 struts2 in Action
Struts2 实战 Struts 2 in Action
前几天在网上下载一个struts2的helloword的例子,那个作者也真够缺德的,搞个错误的程序,害得我查了一天的程序错误。 最后发现竟然是struts.xml被写成啦sturts.xml。 碰见这样的问题先鄙视下提供例子的作者, 再...
首先,Struts的ActionServlet接收到一个请求,然后根据struts-config.xml的配置定位到相应的mapping (映射);接下来如果form的范围是request或者在定义的范围中找不到这个form,创建一个新的form实例;取得form...
struts2利用通配符调用同一个Action里面不同的方法,在struts.xml配置文件中将请求方法的不相同部分抽象成“*".
第一部分 Strut 2:一个全新的框架 第1章 Struts 2:现代Web框架 2 1.1 Web应用程序:快速学习 2 1.1.1 构建Web应用程序 2 1.1.2 基础技术简介 3 1.1.3 深入研究 6 1.2 Web应用程序框架 7 1.2.1 什么是框架 7 1.2.2 ...
Struts2 in action 中文版
struts2 in action 源码
Struts 2实战,Struts 2 in action 的中文版,pdf格式,讲的是Struts 2。此书是Struts 2的一本很经典的书。花几块钱在网上买的。。。。
Struts2inAction 英文版 非常实用的一本Struts教材
如果你想自学struts2,此文档是很好的自学宝典,经典struts2 in Action,能帮你建立整体的struts2思想,你还在犹豫什么
从jsp页面提交form表单后,在struts.xml中寻找匹配的action。在action中处理完业务后返回,在struts.xml中的result属性中转向到另外一个action。
Struts的小列子三个ActionStruts的小列子三个ActionStruts的小列子三个Action
Struts 2 Action类可以实现一个Action接口,也可以实现其他接口,使可选和定制的服务成为可能。Struts 2提供一个ActionSupport基类去实现常用的接口。即使Action接口不是必须实现的,只有一个包含execute方法的POJO...
NULL 博文链接:https://namas.iteye.com/blog/1130854
Struts2 In Action中文版,完整PDF。
struts2 in actionstruts2 in actionstruts2 in actionstruts2 in actionstruts2 in actionstruts2 in actionstruts2 in action