<!-- Feedsky FEED发布代码开始 -->
如果您喜欢这些文章,欢迎点击此处订阅本Blog
<!-- FEED自动发现标记开始 --> <link title="RSS 2.0" type="application/rss+xml" href="http://feed.feedsky.com/softwave" rel="alternate"> <!-- FEED自动发现标记结束 -->
<!--Google 468*60横幅广告开始--><script type="text/javascript"><!-- google_ad_client = "pub-7343546549496470"; google_ad_width = 468; google_ad_height = 60; google_ad_format = "468x60_as"; google_ad_type = "image"; //2007-07-26: CSDN google_ad_channel = "6063905817"; google_color_border = "6699CC"; google_color_bg = "E6E6E6"; google_color_link = "FFFFFF"; google_color_text = "333333"; google_color_url = "AECCEB"; google_ui_features = "rc:6"; //--> </script><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script><!--Google 468*60横幅广告结束-->
JSON-taglib是一套JSP标签库用于在JSP代码中输出JSON格式的数据。
JSON-taglib利用json:array, json:object和json:property来实现数据格式的转换。
JOSN输出结果:
Be sure to check out
the examples
or
the tutorial
for more information about how to use the taglib.
官网: http://json-taglib.sourceforge.net/
<!--新Google 468*60横幅广告开始--><script type="text/javascript"><!-- google_ad_client = "pub-7343546549496470"; /* 468x60, 创建于 08-8-6 */ google_ad_slot = "7368701459"; google_ad_width = 468; google_ad_height = 60; //--> </script><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script><!--新Google 468*60横幅广告结束-->
<!--新Google 468x15 横链接单元开始--><script type="text/javascript"><!-- google_ad_client = "pub-7343546549496470"; /* 468x15 横链接单元 */ google_ad_slot = "5785741422"; google_ad_width = 468; google_ad_height = 15; //--> </script><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script><!--新Google 468x15 横链接单元结束-->
<!-- Google Reader shared发布代码开始 --><script type="text/javascript" src="http://www.google.com/reader/ui/publisher.js"></script><script type="text/javascript" src="http://www.google.com/reader/public/javascript/user/00697638153916680411/state/com.google/broadcast?n=5&callback=GRC_p(%7Bc%3A%22green%22%2Ct%3A%22%5Cu8FD9%5Cu4E9B%5Cu6587%5Cu7AE0%5Cu4E5F%5Cu503C%5Cu5F97%5Cu4E00%5Cu770B%22%2Cs%3A%22false%22%7D)%3Bnew%20GRC"></script><!-- Google Reader shared发布代码结束 -->
<!--Google 468*60横幅广告开始--><script type="text/javascript"><!-- google_ad_client = "pub-7343546549496470"; google_ad_width = 468; google_ad_height = 60; google_ad_format = "468x60_as"; google_ad_type = "image"; //2007-07-26: CSDN google_ad_channel = "6063905817"; google_color_border = "6699CC"; google_color_bg = "E6E6E6"; google_color_link = "FFFFFF"; google_color_text = "333333"; google_color_url = "AECCEB"; google_ui_features = "rc:6"; //--> </script><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script><!--Google 468*60横幅广告结束-->
JSON-taglib是一套JSP标签库用于在JSP代码中输出JSON格式的数据。
JSON-taglib利用json:array, json:object和json:property来实现数据格式的转换。
下面是具体用法:
Just drop the json-taglib.jar file into the WEB-INF/lib directory of your web-application.
Here's a quick example of how the taglib could be used with an AJAX e-commerce shopping cart. Check out the examples or the tutorial for full details of how to use the taglib.
调用方法:- <%@taglibprefix= "json" uri= "http://www.atg.com/taglibs/json" %>
- <json:object>
- <json:propertyname= "itemCount" value= "${cart.itemCount}" />
- <json:propertyname= "subtotal" value= "${cart.subtotal}" />
- <json:arrayname= "items" var= "item" items= "${cart.lineItems}" >
- <json:object>
- <json:propertyname= "title" value= "${item.title}" />
- <json:propertyname= "description" value= "${item.description}" />
- <json:propertyname= "imageUrl" value= "${item.imageUrl" />
- <json:propertyname= "price" value= "${item.price}" />
- <json:propertyname= "qty" value= "${item.qty}" />
- </json:object>
- </json:array>
- </json:object>
- {
- itemCount:2,
- subtotal: "$15.50" ,
- items:[
- {
- title: "TheBigBookofFoo" ,
- description: "BestsellingbookofFoobyA.N.Other" ,
- imageUrl: "/images/books/12345.gif" ,
- price: "$10.00" ,
- qty:1
- },
- {
- title: "JavascriptPocketReference" ,
- description: "Handypocket-sizedreferencefortheJavascriptlanguage" ,
- imageUrl: "/images/books/56789.gif" ,
- price: "$5.50" ,
- qty:1
- }
- ]
- }
官网: http://json-taglib.sourceforge.net/
<!--新Google 468*60横幅广告开始--><script type="text/javascript"><!-- google_ad_client = "pub-7343546549496470"; /* 468x60, 创建于 08-8-6 */ google_ad_slot = "7368701459"; google_ad_width = 468; google_ad_height = 60; //--> </script><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script><!--新Google 468*60横幅广告结束-->
<!--新Google 468x15 横链接单元开始--><script type="text/javascript"><!-- google_ad_client = "pub-7343546549496470"; /* 468x15 横链接单元 */ google_ad_slot = "5785741422"; google_ad_width = 468; google_ad_height = 15; //--> </script><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script><!--新Google 468x15 横链接单元结束-->
<!-- Google Reader shared发布代码开始 --><script type="text/javascript" src="http://www.google.com/reader/ui/publisher.js"></script><script type="text/javascript" src="http://www.google.com/reader/public/javascript/user/00697638153916680411/state/com.google/broadcast?n=5&callback=GRC_p(%7Bc%3A%22green%22%2Ct%3A%22%5Cu8FD9%5Cu4E9B%5Cu6587%5Cu7AE0%5Cu4E5F%5Cu503C%5Cu5F97%5Cu4E00%5Cu770B%22%2Cs%3A%22false%22%7D)%3Bnew%20GRC"></script><!-- Google Reader shared发布代码结束 -->