struts2升级的json输出配置注意事项

<result name="success" type="json">
  <param name="root">action</param><!-- 指定这个就是指当前的这个action里面的所有get方法 -->
  <param name="ignoreHierarchy">false</param><!-- 指定这个就是指要输出父类里面的get方法 -->
  <param name="excludeProperties">
    actionErrors.*,
    actionMessages.*,
    fieldErrors.*,
    errorMessages.*,
    errors.*,
    locale.*,
    texts.*
  </param>
  <param name="excludeNullProperties">false</param>
  <!--使用true/false 默认为false(即包含属性值为null的字段)-->
  <!-- 指定内容类型,默认为application/json,IE浏览器会提示下载 -->
  <!--<param name="contentType">text/html</param>-->
  <!-- The request must include "gzip" in the "Accept-Encoding" header for this to work. -->
  <param name="enableGZIP">true</param>
  <param name="noCache">true</param>
</result>

猜你喜欢

转载自keren.iteye.com/blog/1980491
今日推荐