Struts2 中 result type=”json” 的参数解释
转自:http://wangquanhpu.iteye.com/blog/1461750
1, ignoreHierarchy 参数:表示是否忽略等级,也就是继承关系,比如:TestAction 继承于 BaseAction,那么 TestAction 中返回的 json 字符串默认是不会包含父类 BaseAction 的属性值,ignoreHierarchy 值默认为 true,设置为 false 后会将父类和子类的属性一起返回。
- <result type=”json”>
- <paramname=”ignoreHierarchy”>false</param>
- </result>
2, excludeNullProperties 参数:表示是否去掉空值,默认值是 false,如果设置为 true 会自动将为空的值过滤,只输出不为空的值。
- <result ype=”json”>
- <paramname=”excludeNullProperties”>true</param>
- </result>
3, root 参数:从返回结果中根据 ognl 表达式取出你需要输出的结果。
只输出 person 对象的 name 属性值,配置如下:
- <result type=”json”>
- <param name=”root”>person.name</param>
- </result>
4, includeProperties 参数:输出结果中需要包含的属性值,这里正则表达式和属性名匹配,可以用 “,” 分割填充多个正则表达式。
- <result type=”json”>
- <param name=”includeProperties”>person.*, person\.name</param>
- </result>
5, excludeProperties 参数:输出结果需要剔除的属性值,也支持正则表达式匹配属性名,可以用 “,” 分割填充多个正则表达式,类同 includeProperties 参数。
Struts2 中 result type=”json” 的参数解释的更多相关文章
- Struts2 中result type属性说明
Struts2 中result type属性说明 首先看一下在struts-default.xml中对于result-type的定义: <result-types><result-t ...
- struts2 中 result type="stream"
Stream result type是Struts2中比较有用的一个feature.特别是在动态生成图片和文档下载的情况下 1:图片验证码: Action类,action主要要提供一个获取InputS ...
- jquery序列化from表单使用ajax提交返回json数据(使用struts2注解result type = json)
1.action类引入struts2的"json-default"拦截器栈 @ParentPackage("json-default") //示例 @Paren ...
- struts2.xml 中result type属性说明
chain 用来处理Action链,被跳转的action中仍能获取上个页面的值,如request信息. com.opensymphony.xwork2.Acti ...
- Caused by: The Result type [json] which is defined in the Result annotation on the class
1.错误描述 严重: Dispatcher initialization failed Unable to load configuration. - [unknown location] at co ...
- struts2 action result type类型
struts2 action result type类型 1.chain:用来处理Action链,被跳转的action中仍能获取上个页面的值,如request信息. com.opensymphony. ...
- Struts2中 Result类型配置详解
一个result代表了一个可能的输出.当Action类的方法执行完成时,它返回一个字符串类型的结果码,框架根据这个结果码选择对应的result,向用户输出.在com.opensymphony.xwor ...
- Struts2自定义Result处理JSON
以前在采用Struts2开发的项目中,对JSON的处理一直都在Action里处理的,在Action中直接Response,最近研读了一下Struts2的源码,发现了一个更加优雅的解决办法,自己定义一个 ...
- Struts2 语法--result type
result type: dispatcher,redirect:只能跳转到jsp,html之类的页面,dispatcher属于服务器跳转, redirect属于客户端跳转 chain: 等同于for ...
随机推荐
- Java_Web三大框架之Hibernate增删改查
下面介绍一下Hibernate的增删改查. 第一步:编写用户实体类以及User.hbm.xml映射 package com.msl.entity; public class User { privat ...
- Discuz 首页图文列表实现
<div id="shoucang"> <!--{eval $list_count=0;}--> <!--{loop $threadlist $thr ...
- windows环境搭建ui自动化环境
windows环境安装python虚拟环境 https://www.cnblogs.com/suke99/p/5355894.html https://www.cnblogs.com/jiuyang/ ...
- Git学习总结(标签管理)
在Git中打标签非常简单,首先,切换到需要打标签的分支上: 然后,敲命令git tag <name>就可以打一个新标签: $ git tag v1. 可以用命令git tag查看所有标签: ...
- golang bytes 包
类型 []byte 的切片十分常见,Go 语言有一个 bytes 包专门用来解决这种类型的操作方法. bytes 包和字符串包十分类似.而且它还包含一个十分有用的类型 Buffer: import & ...
- Self-Attetion
四.self-attention 1.是什么? attention机制通常用在encode与decode之间,但是self-attention则是输入序列与输出序列相同,寻找序列内部元素的关系即 K= ...
- How To:配置Openfiler磁盘
目录 1.系统登陆 2.启用iSCSI Target服务 3.初始化卷组 4.映射LUN 5.查看状态 1.系统登陆 Openfiler系统安装完毕之后,使用提示的地址登陆:https://172.1 ...
- js-2018-11-01 关于break和continue语句
1.label语句 语法:label: statement 加标签语句一般都要与for语句等循环语句配合使用. 2.break语句 立即退出循环,强制执行循环后面的语句. 3.continue语句 立 ...
- odoo widget 标签介绍
widget="statusbar" 头部状态条标签 widget="email" 电子邮件地址标签 widget="selection" ...
- 第一节:numpy之ndarray对象数据类型及属性