我的博客我做主

          我的未來(lái)不是夢(mèng)!
          posts - 9, comments - 10, trackbacks - 0, articles - 0
            BlogJava :: 首頁(yè) :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理

          日歷

          <2012年2月>
          2930311234
          567891011
          12131415161718
          19202122232425
          26272829123
          45678910

          公告

          Locations of visitors to this page

          搜索

          •  
          更多博客請(qǐng)查看:http://www.v5cn.cn
          只需在XML配置就可以了,配置方式是:
          <?xml version="1.0" encoding="UTF-8" ?>
          <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.1//EN" "http://struts.apache.org/dtds/struts-2.1.dtd">
          <struts>
              
          <package name="jsons" extends="json-default" namespace="/">
                  
          <action name="getJSON" class="test.json.Users">
                      
          <result name="success" type="json">
                          
          <!-- excludeProperties表示不包含的屬性(可以使用正則表達(dá)式匹配) -->
                          
          <param name="excludeProperties">
                              id,userName
                          
          </param>
                          
          <!-- includeProperties表示包含序列化的屬性(可以使用正則表達(dá)式匹配) -->
                          
          <param name="includeProperties">
                              pwd,address
                          
          </param>
                      
          </result>
                  
          </action>
              
          </package>
          </struts>    
          默認(rèn)情況下Struts2插件的序列化是從Action開(kāi)始的如果需要序列化從指定的方式開(kāi)始請(qǐng)使用:
          <!-- 這樣序列化工作就從birthday開(kāi)始了 -->
                          
          <param name="root">
                              birthday
                          
          </param>
          Struts2JSONPlugin使用文檔.pdf

          評(píng)論

          # re: Struts2+JSON+jQuery實(shí)現(xiàn)異步交互數(shù)據(jù)時(shí)選擇要序列化的屬性(二使用XML配置方式)  回復(fù)  更多評(píng)論   

          2012-02-28 21:46 by 求解者
          可以加Q聊不,492781905
          主站蜘蛛池模板: 石城县| 浏阳市| 西和县| 仙居县| 合川市| 白山市| 洞口县| 华池县| 三河市| 新郑市| 英德市| 临高县| 政和县| 清徐县| 隆尧县| 淮南市| 建瓯市| 泗洪县| 白城市| 新晃| 香格里拉县| 友谊县| 集贤县| 蒙自县| 修武县| 晋城| 江达县| 潜江市| 龙门县| 博乐市| 鄢陵县| 富宁县| 方正县| 榕江县| 山西省| 安达市| 武陟县| 佛山市| 班玛县| 瑞昌市| 马鞍山市|