【问题标题】:Struts2 filter json result /custom resultStruts2过滤json结果/自定义结果
【发布时间】:2012-08-23 17:59:09
【问题描述】:

我目前正在研究将 json 结果从 struts2 发送回客户端的解决方案。

我遵循了这个例子:

http://www.mkyong.com/struts2/struts-2-and-json-example/

它工作正常,但问题是,struts2 在结果 json 中发回了太多信息,因为我得到了一些不应该显示给客户的变量。

有没有办法将我自己的 Json 发回或在发回之前过滤结果?

【问题讨论】:

    标签: java jquery ajax json struts2


    【解决方案1】:

    你可以排除你不希望JSON插件为你序列化的属性

    <result type="json">
      <param name="excludeProperties">
        login.password,
        studentList.*\.sin
      </param>
    </result>
    

    详情请参考JSON plugin页面

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-01-05
      • 2020-05-01
      • 2017-05-15
      • 1970-01-01
      • 1970-01-01
      • 2015-08-07
      • 1970-01-01
      • 2019-10-20
      相关资源
      最近更新 更多