xia*_*012 5 json struts2 actioncontroller
对不起,我真的不知道如何总结这个问题的标题.所以,标题可能不清楚.
我有一个执行一些业务逻辑的动作类.
在Action类中:
class ActionClass extends ActionSupport{
private Merchandise merchandise;// I want to transfer it to the client
//setter and getter
}
Run Code Online (Sandbox Code Playgroud)
在商品类中:
class Merchandise{
private String name; // I want to transfer it
private String price; //I don't want to transfer it
private String description;//I don't want to transfer it
//setter and getter
}
Run Code Online (Sandbox Code Playgroud)
现在,我需要将ActionClass中的商品属性转移到客户端.
但是,在商品属性中,我只想传输name属性,同时禁止其他两个属性.
那么如何抑制商品类中其他两个属性(价格和描述)的转移?
尝试类似的东西:
<!-- Result fragment -->
<result type="json">
<param name="root">merchandise</param>
<param name="excludeProperties">price,description</param>
</result>
Run Code Online (Sandbox Code Playgroud)
请参阅http://struts.apache.org/2.2.3/docs/json-plugin.html上的完整文档,其他选项和示例.
| 归档时间: |
|
| 查看次数: |
1433 次 |
| 最近记录: |