`

strust2-json-struts2jsonresult0.99.jar

阅读更多

这个json的插件不是apache那个,这是它的地址http://code.google.com/p/struts2jsonresult/

 

使用方式和apache的差不多,这里讲讲在action的使用

 

1.

@Result(name = ActionSupport.SUCCESS, type = "json",params={"deepSerialize","true"})

 注解,注意下params里面的参数deepSerialize,没有这个参数不会序列话数组

 

下面是官方文档,看到没,默认是不序列话collection的

 

deepSerialize false whether to deep serialize the object, by default flexjson will not serialize the collections in a bean

 

2.

@JSON(include=false)
	public DatingService getDatingService() {
		return datingService;
	}

 这个注解放在getXXXX方法上,就不会输出这个成员变量

 

3.

@Result(name = ActionSupport.SUCCESS, type = "json",params={"target","map"})

 params中的target指定输出名为“map”的变量,其他都被屏蔽了,即是不输出其他信息

 

 

 

 

 

 

分享到:
评论
1 楼 rjw 2011-12-17  
请问如何将struts2jsonresult配置到pom.xml中呢,他的groupId等,该怎么写?

相关推荐

Global site tag (gtag.js) - Google Analytics