转自:http://wangquanhpu.iteye.com/blog/1461750 1, ignoreHierarchy 参数:表示是否忽略等级,也就是继承关系,比如:TestAction 继承于 BaseAction,那么 TestAction 中返回的 json 字符串默认是不会包含父类 BaseAction 的属性值,ignoreHierarchy 值默认为 true,设置为 false 后会将父类和子类的属性一起返回. <result type=”json”> <param…
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…
Stream result type是Struts2中比较有用的一个feature.特别是在动态生成图片和文档下载的情况下 1:图片验证码: Action类,action主要要提供一个获取InputStrem的方法: public class CheckCodeAction extends ActionSupport implements SessionAware { private Logger log = LoggerFactory.getLogger(this.getClass()); p…
1.action类引入struts2的"json-default"拦截器栈 @ParentPackage("json-default") //示例 @ParentPackage(WapBaseAction.WAP_PACKAGE) //WAP_PACKAGE继承了json-default @Namespace("/") public class ModifyResumeAction extends WapBaseAction {... 2.@Ac…
chain           用来处理Action链,被跳转的action中仍能获取上个页面的值,如request信息.           com.opensymphony.xwork2.ActionChainResult       dispatcher           用来转向页面,通常处理JSP           org.apache.struts2.dispatcher.ServletDispatcherResult       freemaker           处理Fr…
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…
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代表了一个可能的输出.当Action类的方法执行完成时,它返回一个字符串类型的结果码,框架根据这个结果码选择对应的result,向用户输出.在com.opensymphony.xwork2.Action接口中定义了一组标准的结果代码,可供开发人员使用,当然了只有我们的action继承ActionSupport 这个类才可以使用下面的结果代码,如下所示:public interface Action{    public static final String SUCCESS =…
以前在采用Struts2开发的项目中,对JSON的处理一直都在Action里处理的,在Action中直接Response,最近研读了一下Struts2的源码,发现了一个更加优雅的解决办法,自己定义一个ResultType, 首先大家先看下Struts2中的源码 包com.opensymphony.xwork2下的DefaultActionInvocation 472行 /** * Save the result to be used later. * @param actionConfig cu…
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…