http://www.bubuko.com/infodetail-2492575.html .............................................. 标签:lai   util   date   cati   rec   turn   nds   csdn   bsp http://blog.csdn.net/z69183787/article/details/16342553 struts2的@Result annotation 如何添加params,并且在…
参考: http://struts.apache.org/2.0.11/docs/result-annotation.html http://jdkcn.com/entry/add-params-to-struts2-result-annotation.html 在原来的webwork式的xml配置文件里可以给<action>下的<result>节点添加一些额外的参数.<result ..>      <param name="">...…
Struts2 配置文件result的name属性和type属性:Name属性SUCCESS:Action正确的执行完成,返回相应的视图,success是 name属性的默认值: NONE:表示Action正确的执行完成,但并不返回任何视图: ERROR:表示Action执行失败,返回到 错误处理视图: INPUT:Action的执行,需要从前端界面获取参数,INPUT就是代表这个参数输入的界面,一般在应用中,会对这些参数进 行验证,如果验证没有通过,将自动返回到该视图: LOGIN:Actio…
注意:我只要是解决自定义返回Json 和异常处理问题 新建一个类 AjaxResult   继承 StrutsResultSupport 看看代码吧 public class AjaxResult extends StrutsResultSupport { /** * serialVersionUID */ private static final long serialVersionUID = 1L; private static final String AJAX_SUCCESS = "{\…
Struts2中基于Annotation的细粒度权限控制 2009-10-19 14:25:53|  分类: Struts2 |  标签: |字号大中小 订阅     权限控制是保护系统安全运行很重要的一扇门.在web应用里,仅仅隐藏url是不够的.由于web应用是以请求/响应为单位的,我 们的权限控制的粒度只有达到这个程度才能让全国人民放心.在java web开发的世界里,MVC框架的使用再平常不过,大都是将请求拦截后,控制器根据配置文件将请求转给某个函数来处理.下面看看在struts2中我们…
上一篇我们把Struts2中的Action接收参数的内容为大家介绍了,本篇我们就一起来简单学习一下Action的4种Result type类型,分为:dispatcher(服务端页面跳转):redirect(客户端页面跳转):chain(动作链跳转):redirectAction(客户端Action跳转),当然还有其他类型,这里我们就以这四种为例为大家介绍一下,其他几种大家有兴趣单独学习.下面我们一起来看一下上面四种的具体实现,首先是我们的配置文件: <package name="resu…
1.错误描述 严重: Dispatcher initialization failed Unable to load configuration. - [unknown location] at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:70) at org.apache.struts2.dispatcher.Dispatcher.getContai…
一.在strut2的action处理完成后,就应该向用户返回结果信息result 根据以下代码作为实例分析: <package name="Hello" extends="struts-default"> <global-results> <result name="error">error.jsp</result> </global-results> <action name=&…
Struts2 中result type属性说明 首先看一下在struts-default.xml中对于result-type的定义: <result-types><result-type name="chain" class="com.opensymphony.xwork2.ActionChainResult"/><result-type name="dispatcher" class="org.apac…
struts2 action result type类型 1.chain:用来处理Action链,被跳转的action中仍能获取上个页面的值,如request信息. com.opensymphony.xwork2.ActionChainResult 2.dispatcher:用来转向页面,通常处理JSP org.apache.struts2.dispatcher.ServletDispatcherResult 3.freemaker:处理FreeMarker模板 org.apache.strut…
result: 1). result 是 action 节点的子节点 2). result 代表 action 方法执行后, 可能去的一个目的地 3). 一个 action 节点可以配置多个 result 子节点. 4). result 的 name 属性值对应着 action 方法可能有的一个返回值.   <result name="index">/index.jsp</result> 5). result 一共有 2 个属性, 还有一个是 type: 表示结…
1.action类引入struts2的"json-default"拦截器栈 @ParentPackage("json-default") //示例 @ParentPackage(WapBaseAction.WAP_PACKAGE) //WAP_PACKAGE继承了json-default @Namespace("/") public class ModifyResumeAction extends WapBaseAction {... 2.@Ac…
一.result简述 result:输出结果:第个Action返回一个字符串,Struts2根据这个值来决定响应结果 name属性:result的逻辑名.和Actin里的返回值匹配,默认"success" 值 :指定对应的实际资源位置 二.Action中返回其它值 如果Action中返回其它扯,result中的Name属性要与之对应才可以找到指定的资源 Action默认定义了一些常量,可以拿来使用 package com.opensymphony.xwork2; public inte…
一.概要 二.常用四种类型的配置 Struts.xml <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" "http://struts.apache.org/dtds/struts-2.0.dtd"&g…
简单的说,Result是Action执行完后返回的一个字符串,它指示了Action执行完成后,下一个页面在哪里.Result仅仅是个字符串,仅仅是用来指示下一个页面的,那么如何才能够到达下一个页面呢?下一个页面如何能正确地展示结果呢?这就该引出一个新概念——ResultType,所谓ResultType,指的是具体执行Result的类,由它来决定采用哪一种视图技术,将执行结果展现给用户. 很多时候,我们并不去区分Result和ResultType,而是笼统的称为Result.因此,Result除…
一共有两个属性name和type name这里就不介绍了 type    返回结果的类型,值可以从default-struts.properties中看到看到 常用的值:dispatcher (默认)转发.redirect 重定向.redirectAction  重定向到Action.chain 转发到Action.还有一个是stream一般用于文件下载的 这里不得不提下转发和重定向的区别: 这里不得不提下重定向与请求转发的区别 一 转发是服务器行为,重定向是客户端行为.为什么这样说呢,这就要看…
一个result代表了一个可能的输出.当Action类的方法执行完成时,它返回一个字符串类型的结果码,框架根据这个结果码选择对应的result,向用户输出.在com.opensymphony.xwork2.Action接口中定义了一组标准的结果代码,可供开发人员使用,当然了只有我们的action继承ActionSupport 这个类才可以使用下面的结果代码,如下所示:public interface Action{    public static final String SUCCESS =…
在action的指定方法执行完毕后总会返回一个字符串,struts2根据返回的字符串去action的配置中的result去找匹配的名字,根据配置执行下一步的操作. 在ActionSupport基类中定义了五个标准的返回值 String SUCCESS       = "success"; String NONE     = "none"; String ERROR    = "error"; String INPUT    = "inp…
chain           用来处理Action链,被跳转的action中仍能获取上个页面的值,如request信息.           com.opensymphony.xwork2.ActionChainResult       dispatcher           用来转向页面,通常处理JSP           org.apache.struts2.dispatcher.ServletDispatcherResult       freemaker           处理Fr…
<result name="success">/html/portlet/ext/trainingmanagement/download_file.jsp?path=${path}&fileName=${fileName}&mimeType=${mimeType} </result> 如果你在连接参数时只是用了&,那么struts.xml会把它当做特殊字符处理. 所以我们应该使用&代替&. 参考:struts给result…
<!--struts.xml配置--> <action name="download" class="com.unmi.action.DownloadAction"> <result name="success" type="stream"><!--type 为 stream 应用 StreamResult 处理--> <param name="contentTy…
result type: dispatcher,redirect:只能跳转到jsp,html之类的页面,dispatcher属于服务器跳转, redirect属于客户端跳转 chain: 等同于forwardaction, redirectAction: 客户端跳转到另一个action 还有freemarker,httpheader,stream(下载),volocity(类似freemarker), xslt, plaintext,tiles <?xml version="1.0&quo…
这一章节主要介绍如何配置结果集,分为以下几个知识点: 结果集类型(result type) 全局结果集(global types) 动态结果集(dynamic type) 带有参数的结果集(type with params) result type: 结果集类型一共有十一种: dispatcher redirect chain redirectAction freemarker httpheader stream velocity xslt plaintext tiles 最常用的是前两种:一个…
我们已经知道之前的切面添加方式(动态代理),是定义了一个实现了InvocationHandler接口的Handlerservice类,然后 在这个类内部写好切面逻辑,包括切面放置的位置,很显然下面的这个切面逻辑是放置在原先方法之前的. public class Handlerservice implements InvocationHandler { private UserDao o; public Handlerservice(UserDao o) { super(); this.o = o…
Struts2 result类型 1.dispatcher:服务器跳转到页面,通常来处理JSP,默认类型. 2.redirect:重定向到页面. Action: 1 public String redirect() { 2 message = "message中有值"; 3 return "redirect"; 4 } struts.xml 1 <package name="chapter3" namespace="/chapte…
转自:https://zhidao.baidu.com/question/133574016.html 1 String 里面有5个static 常量分别是: ERROR INPUT LOGIN NONE SUCCESS 例如 如果在excute 中返回的是 ruturn SUCCESS; 也就相当于返回的是return "success"字符串 就必须在struts.xml中写上对应的"success" <result name="success&…
以前在采用Struts2开发的项目中,对JSON的处理一直都在Action里处理的,在Action中直接Response,最近研读了一下Struts2的源码,发现了一个更加优雅的解决办法,自己定义一个ResultType, 首先大家先看下Struts2中的源码 包com.opensymphony.xwork2下的DefaultActionInvocation 472行 /** * Save the result to be used later. * @param actionConfig cu…
Stream result type是Struts2中比较有用的一个feature.特别是在动态生成图片和文档下载的情况下 1:图片验证码: Action类,action主要要提供一个获取InputStrem的方法: public class CheckCodeAction extends ActionSupport implements SessionAware { private Logger log = LoggerFactory.getLogger(this.getClass()); p…
"No result defined for action ... and result input"错误一般发生在Struts2的拦截器拦截时遇到了问题时.Struts2会将跳转到result为input的视图上,可是在配置文件里并没有给这个Action配置input的result. 能够建立一个内容为例如以下的Jsp文件.并在配置文件里配置result为input时跳转此文件.将会显示出详细的错误原因. <div style="color:red">…
概述 <action name="helloworld" class="com.liuyong666.action.HelloWorldAction"> <result name="success">/WEB-INF/page/hello.jsp</result> </action> result配置类似于struts1中的forward,但struts2中提供了多种结果类型,常用的类型有: dis…