日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 编程资源 > 编程问答 >内容正文

编程问答

Struts result param详细设置

發(fā)布時(shí)間:2024/9/27 编程问答 24 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Struts result param详细设置 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
Xml代碼 ?
  • <result?type="json">??
  • ????????????????<!--?這里指定將被Struts2序列化的屬性,該屬性在action中必須有對(duì)應(yīng)的getter方法?-->??
  • ????????????????<!--?默認(rèn)將會(huì)序列所有有返回值的getter方法的值,而無論該方法是否有對(duì)應(yīng)屬性?-->??
  • ????????????????<param?name="root">dataMap</param>??
  • ????????????????<!--?指定是否序列化空的屬性?-->??
  • ????????????????<param?name="excludeNullProperties">true</param>??
  • ????????????????<!--?這里指定將序列化dataMap中的那些屬性?-->??
  • ????????????????<param?name="includeProperties">??
  • ????????????????????userList.*??
  • ????????????????</param>??
  • ????????????????<!--?這里指定將要從dataMap中排除那些屬性,這些排除的屬性將不被序列化,一半不與上邊的參數(shù)配置同時(shí)出現(xiàn)?-->??
  • ????????????????<param?name="excludeProperties">??
  • ????????????????????SUCCESS??
  • ????????????????</param>??
  • </result>??
  • <result type="json"><!-- 這里指定將被Struts2序列化的屬性,該屬性在action中必須有對(duì)應(yīng)的getter方法 --><!-- 默認(rèn)將會(huì)序列所有有返回值的getter方法的值,而無論該方法是否有對(duì)應(yīng)屬性 --><param name="root">dataMap</param><!-- 指定是否序列化空的屬性 --><param name="excludeNullProperties">true</param><!-- 這里指定將序列化dataMap中的那些屬性 --><param name="includeProperties">userList.*</param><!-- 這里指定將要從dataMap中排除那些屬性,這些排除的屬性將不被序列化,一半不與上邊的參數(shù)配置同時(shí)出現(xiàn) --><param name="excludeProperties">SUCCESS</param> </result>

    Xml代碼 ?
  • <!--?新聞跳轉(zhuǎn)管理?-->??
  • ????????<action??
  • ????????????name="news"??
  • ????????????class="newsAction">??
  • ????????????<result>/content/news/index.jsp</result>??
  • ????????????<result??
  • ????????????????name="update"??
  • ????????????????type="json"?/>??
  • ????????????<!--<result??
  • ????????????????name="detail">/content/news/detail.jsp</result>??
  • ????????????-->??
  • ????????????<result??
  • ????????????????name="detail"??
  • ????????????????type="json">??
  • ????????????????<param??
  • ????????????????????name="includeProperties">name,list.*,feeds.*</param>??
  • ????????????</result>??
  • ????????</action>??
  • <!-- 新聞跳轉(zhuǎn)管理 --><actionname="news"class="newsAction"><result>/content/news/index.jsp</result><resultname="update"type="json" /><!--<resultname="detail">/content/news/detail.jsp</result>--><resultname="detail"type="json"><paramname="includeProperties">name,list.*,feeds.*</param></result></action>

    Java代碼 ?
  • private?String?name;??
  • ????private?INewsService?newsService;??
  • ????private?List?list;??
  • ????private?WeiboFeeds?feeds?=?new?WeiboFeeds();??
  • ????private?Map<String,?Object>?session;??
  • ??
  • ????public?WeiboFeeds?getFeeds()?{??
  • ????????return?feeds;??
  • ????}??
  • ??
  • ????public?void?setFeeds(WeiboFeeds?feeds)?{??
  • ????????this.feeds?=?feeds;??
  • ????}??
  • ??
  • ????public?List?getList()?{??
  • ????????return?list;??
  • ????}??
  • ??
  • ????public?void?setList(List?list)?{??
  • ????????this.list?=?list;??
  • ????}??
  • ??
  • ????public?INewsService?getNewsService()?{??
  • ????????return?newsService;??
  • ????}??
  • ??
  • ????public?void?setNewsService(INewsService?newsService)?{??
  • ????????this.newsService?=?newsService;??
  • ????}??
  • ??
  • ????public?String?getName()?{??
  • ????????return?name;??
  • ????}??
  • ??
  • ????public?void?setName(String?name)?{??
  • ????????this.name?=?name;??
  • ????}??
  • private String name;private INewsService newsService;private List list;private WeiboFeeds feeds = new WeiboFeeds();private Map<String, Object> session;public WeiboFeeds getFeeds() {return feeds;}public void setFeeds(WeiboFeeds feeds) {this.feeds = feeds;}public List getList() {return list;}public void setList(List list) {this.list = list;}public INewsService getNewsService() {return newsService;}public void setNewsService(INewsService newsService) {this.newsService = newsService;}public String getName() {return name;}public void setName(String name) {this.name = name;}

    Js代碼 ?
  • $("#subForm").click(function()?{??
  • ????????????????var?url?=?"news!retrieveById.action";??
  • ????????????????$.ajax({??
  • ????????????????????????????url?:?url,??
  • ????????????????????????????cache?:?false,??
  • ????????????????????????????data?:?{??
  • ????????????????????????????????"name"?:?"I?love?You!"??
  • ????????????????????????????},??
  • ????????????????????????????type?:?"POST",??
  • ????????????????????????????datatype?:?"json",??
  • ????????????????????????????success?:?function(data)?{??
  • ????????????????????????????????//?alert(data.feeds.id);??
  • ????????????????????????????????var?result?=?"";??
  • ????????????????????????????????$.each(data.list,?function(index,?value)?{??
  • ????????????????????????????????????????????result?+=?(index?+?"[==]"?+?value[index]);??
  • ????????????????????????????????????????});??
  • ????????????????????????????????result?+=?"//\r";??
  • ????????????????????????????????$.each(data.list[1],?function(index,?value)?{??
  • ????????????????????????????????????????????result?+=?(index?+?"[==]"?+?value);??
  • ????????????????????????????????????????});??
  • ????????????????????????????????alert(result);??
  • ????????????????????????????}??
  • ????????????????????????});??
  • ????????????});??
  • $("#subForm").click(function() {var url = "news!retrieveById.action";$.ajax({url : url,cache : false,data : {"name" : "I love You!"},type : "POST",datatype : "json",success : function(data) {// alert(data.feeds.id);var result = "";$.each(data.list, function(index, value) {result += (index + "[==]" + value[index]);});result += "//\r";$.each(data.list[1], function(index, value) {result += (index + "[==]" + value);});alert(result);}});});

    總結(jié)

    以上是生活随笔為你收集整理的Struts result param详细设置的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。

    如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。