struts中的ignoreHierarchy 参数和root 参数

struts2

 1.ignoreHierarchy 参数:表示是否忽略等级,也就是继承关系,比如:TestAction继承于BaseAction,那么TestAction中返回的json字符串默认是不会包含父类BaseAction .

2.root 参数用于指定要序列化的根对象,如果省去这一配置,表示要序列化 action 中的所有属性 ignoreHierarchy 为 false 时表示要序列化根对象的所有基类 excludeProperties .

---------------------------------------------------------------------------------------------------
  <global-results>
   <result name="error" type="dispatcher">
     /WEB-INF/jsp/error.jsp
   </result>
   <result name="rst" type="json">
    <param name="root">rst</param>
    <param name="contentType">text/html</param>
   </result>
   <result name="json" type="json">
    <param name="root">json</param>
   </result>
   <result name="extend" type="json">
    <param name="root">json</param>
    <param name="ignoreHierarchy">false</param> 
   </result>
  </global-results>
posted @ 2014-07-23 14:17  huazhiliange  阅读(1369)  评论(0编辑  收藏  举报