struts2°æ±¾£ºstruts-2.1.8.1
Òì³££ºjava.lang.NoClassDefFoundError: com/opensymphony/xwork2/util/TextUtils
ÔÒò£ºjsonplugin-0.34.jar ÅäºÏ struts2-core-2.1.8.1.jar ʹÓõÄÇé¿öϱ¨µÄÒì³££¬µ«ÒÔÇ°µÄÏîÄ¿ÖÐjsonplugin-0.34.jar ÅäºÏ struts2-core-2.1.6.jar ʹÓò»»á³öÏÖÕâÑùµÄÒì³£
½â¾ö·½·¨£ºÈ¥µôjsonplugin-0.34.jar£¬Ê¹ÓÃstruts2-json-plugin-2.1.8.1.jar ºÍ json-lib-2.1.jar£¬struts2-junit-plugin-2.1.8.jarÈý¸ö°ü
±¾ÎÄÀ´×ÔCSDN²©¿Í£¬×ªÔØÇë±êÃ÷³ö´¦£ºhttp://blog.csdn.net/wzlas111/archive/2010/04/05/5451462.aspx ......
ASP.NET 2.0 AjaxÖÐÄܹ»ÔÚ¿Í»§¶ËjsÖкܷ½±ãµØµ÷Ó÷þÎñÆ÷Webservice£¬ÒÔÏÂΪһЩµ÷ÓõÄʾÀý¡£±ÊÕß°²×°µÄASP.NET 2.0 AJAX
°æ±¾ÎªAJAX November CTP¡£
Èý¸öʾÀý·Ö±ðΪ£º
1 ´ø²ÎÊýµÄWS·½·¨
2 ²»´ø²ÎÊýµÄWS·½·¨
3 ²ÎÊýÀàÐÍΪDataTableµÄWS·½·¨
Ò»¡¢WebMethod
×¢ÒâÒªµã£º
1 WebMethodÀàÐèÒªÌí¼ÓÃüÃû¿Õ¼ä Microsoft.Web.Script.Services£¬´Ë¿Õ¼äÐèÒªÒýÓÃMicrosoft.Web.Preview.dll
2 ÀàÉùÃ÷¼ÓÈë±êÇ© [ScriptService]
3 ÔÚAsp.net 2.0Àï¿ÉÒÔÖ±½ÓÓÃDataTable×÷Ϊ·µ»ØÀàÐÍÁË£¬µ«ÊÇÐèÒªÔÚWeb.configÎļþÌí¼ÓÐòÁл¯×ª»»Æ÷µÄÊôÐÔ¡£DataSet¡¢DataTable¡¢DataRow¾ùÓÐת»»Æ÷
< system.web.extensions>
¡¡¡¡< scripting>
¡¡¡¡< webServices>
¡¡¡¡< jsonSerialization>
¡¡¡¡< converters>
¡¡¡¡< add name="DataSetConverter" type="Microsoft.Web.Preview.Script.Serialization.Converters.DataSetConverter, Microsoft.Web.Preview"/>
¡¡¡¡< add name="DataRowConverter" type="Microsoft.Web.Preview.Script.Serialization.Converters.DataRowConverter, Microsoft.Web.Preview"/>
¡¡¡¡< ad ......
ASP.NET 2.0 AjaxÖÐÄܹ»ÔÚ¿Í»§¶ËjsÖкܷ½±ãµØµ÷Ó÷þÎñÆ÷Webservice£¬ÒÔÏÂΪһЩµ÷ÓõÄʾÀý¡£±ÊÕß°²×°µÄASP.NET 2.0 AJAX
°æ±¾ÎªAJAX November CTP¡£
Èý¸öʾÀý·Ö±ðΪ£º
1 ´ø²ÎÊýµÄWS·½·¨
2 ²»´ø²ÎÊýµÄWS·½·¨
3 ²ÎÊýÀàÐÍΪDataTableµÄWS·½·¨
Ò»¡¢WebMethod
×¢ÒâÒªµã£º
1 WebMethodÀàÐèÒªÌí¼ÓÃüÃû¿Õ¼ä Microsoft.Web.Script.Services£¬´Ë¿Õ¼äÐèÒªÒýÓÃMicrosoft.Web.Preview.dll
2 ÀàÉùÃ÷¼ÓÈë±êÇ© [ScriptService]
3 ÔÚAsp.net 2.0Àï¿ÉÒÔÖ±½ÓÓÃDataTable×÷Ϊ·µ»ØÀàÐÍÁË£¬µ«ÊÇÐèÒªÔÚWeb.configÎļþÌí¼ÓÐòÁл¯×ª»»Æ÷µÄÊôÐÔ¡£DataSet¡¢DataTable¡¢DataRow¾ùÓÐת»»Æ÷
< system.web.extensions>
¡¡¡¡< scripting>
¡¡¡¡< webServices>
¡¡¡¡< jsonSerialization>
¡¡¡¡< converters>
¡¡¡¡< add name="DataSetConverter" type="Microsoft.Web.Preview.Script.Serialization.Converters.DataSetConverter, Microsoft.Web.Preview"/>
¡¡¡¡< add name="DataRowConverter" type="Microsoft.Web.Preview.Script.Serialization.Converters.DataRowConverter, Microsoft.Web.Preview"/>
¡¡¡¡< ad ......
ÓÉÓÚ°²È«ÎÊÌâµÄ¿¼ÂÇ£¬Ajax(xmlhttprequest)ĬÈÏÊDz»Ö§³Ö¿çÓòµ÷Óõġ£±ÈÈçÔÚwww.cadal.comÈ¥ÇëÇówww.test.cadal.comµÄÊý¾Ý£¬¶¼ÊDz»Ðеġ£
½â¾ö·½°¸Óкܶ࣬×ܽáÈçÏ£º
²Î¿¼£º
1.ÀûÓÃ<script>±êÇ©
Difficult to know when the content is available, no standard methodology, can be considered a "security risk".
scriptÉèÖÃUrlºó×Ô¶¯»áÖ´ÐÐ
example
簾裼
var data=123;
¿Í»§¶Ë£º
<html>
<body>
<mce:script id="test"></mce:script>
<input type="button" id="button" value="»ñÈ¡" onclick="get('http://test.cadal.com/demo/test.asp');">
<mce:script type="text/javascript"><!--
function get(url)
{
document.getElementById("test").src=url;
alert(data);
}
// --></mce:script>
</body>
</html>
2.´úÀí
Local proxy:
Needs infrastructure (can't run a serverless client) and you get double-taxed on bandwidth and latency (remote - proxy - client).
ÀûÓÃÈ綯̬ÍøÒ³ASP JSP PHPµÈ½øÐдúÀí£¬½øÐÐÖÐת£¬È ......
Õª×Ô£ºhttp://www.ibm.com/developerworks/library/wa-aj-jsonp1/
AJAX Same-Origin Policy(SOP) limitation:
AJAX prevents cross-domail invokation, there are several ways to by pass this limitation.
1. write a proxy on the server side. The SOP limitation only exists only on the javascript side. While on the side, we can still invoke the other domail url such as via HttpClient
2. iFrame ( not sure )
3. JSONP(JSON with Padding)
the same-origin policy doesn't prevent the insertion of dynamic script elements into the document. That is, you could dynamically insert JavaScript from different domains, carrying JSON data in them.
<mce:script type="text/javascript"><!--
// This is our function to be called with JSON data
function showPrice(data) {
alert("Symbol: " + data.symbol + ", Price: " + data.price);
}
var url = “ticker.js”; // URL of the external script
// this shows dynamic script insertion
var script = document.createElement('script') ......
$.ajax({
url: "auto_action.jsp",
type: "POST",
data: {nickName:request.term},
contentType :"application/x-www-form-urlencoded;charset=UTF-8", //¼ÓÉÏÕâ¾ä¾Í¿ÉÒÔÁË£¡
success: function(data) {
alert(data);
}
}); ......
ÎļþÃû£ºajax.js
/**
* È¡µÃµ±Ç°Ò³ÃæµÄurl
* ¿ÉÒÔÔÚµ÷ÓÃajax_queryÇ°ÐÞ¸Ä
**/
var url = location.href.substr(0, location.href.length-location.search.length);
/**
* ¸øFunction¶ÔÏóÌí¼ÓÒ»¸öÈ¡µÃº¯ÊýÃûµÄ·½·¨
**/
Function.prototype.Name = function() {
var s = Function.prototype.Name.caller.toString();
return s.split(/[\r\n]+/)[0].replace(/function\s+(\w+).+/g, '$1');
}
/**
* º¯Êý $
* ¹¦ÄÜ »ñÈ¡dhtml¶ÔÏó
* ²ÎÊý e ´ý²éÕҵĶÔÏóid»òname
* ·µ»Ø ³É¹¦£º¶ÔÏó ʧ°Ü£ºnull
*/
function $(e) {
var tag = document.getElementById(e);
if(tag) return tag;
tag = document.getElementsByName(e);
if(tag.tagName == undefined) return null;
return tag;
}
/**
* º¯Êý ajax_query
* ¹¦ÄÜ Ïò·þÎñÆ÷·¢ËÍÖ¸Á²¢´¦Àí·µ»ØÊý¾Ý
* ²ÎÊý
* method ·þÎñÆ÷¶Ë·½·¨Ãû
* tag ½ÓÊÜ·µ»ØÊý¾ÝµÄdhml¶ÔÏóÃû£¬È±Ê¡Ê±ÓÉ·þÎñÆ÷¾ö¶¨´¦Àí·½Ê½
* &nbs ......