Spring MVC+Ajax´´½¨ÊµÀý
Java´úÂë
@Override
protected ModelAndView onSubmit(HttpServletRequest request, HttpServletResponse response, Object cmd,
BindException ex) {
String userId=request.getParamater("userId");
Map userInfoMap=userDao.getUserBaseInfo(userId);
JSONObject object = new JSONObject();
object.put("userInfoMap",userInfoMap);
response.setContentType("text/Xml;charset=gbk");
PrintWriter out = null;
try {
out = response.getWriter();
out.println(object.toString());
}
catch (IOException ex1) {
ex1.printStackTrace();
}finally{
out.close();
}
return nu
Ïà¹ØÎĵµ£º
´ó¼ÒÏÈ¿´Ò»¶Î¼òµ¥µÄjquery ajax ·µ»ØÖµµÄjs
´úÂë
function getReturnAjax{
$.ajax({
type:"POST",
url:"ajax/userexist.aspx",
data:"username="+vusername.value,
success:function(msg){
&nb ......
Ajax(Asynchronous JavaScript and XML)ÊÇÒ»¸ö½áºÏÁËJava¼¼Êõ¡¢XML¡¢ÒÔ¼°JavaScriptµÄ±à³Ì¼¼Êõ£¬¿ÉÒÔÈÃÄã¹¹½¨»ùÓÚJava¼¼ÊõµÄWebÓ¦Ó㬲¢´òÆÆÁËʹÓÃÒ³ÃæÖØÔØµÄ¹ßÀý¡£
Ajax£¬Òì²½JavaScriptÓëXML£¬ÊÇʹÓÿͻ§¶Ë½Å±¾ÓëWeb·þÎñÆ÷½»»»Êý¾ÝµÄWebÓ¦Óÿª·¢·½·¨¡£ÕâÑù£¬WebÒ³Ãæ²»Óôò¶Ï½»»¥Á÷³Ì½øÐÐÖØÐ¼Ӳ㬾ͿÉÒÔ¶¯Ì¬µØ¸üС£Ê ......
¶àÊý Web Ó¦ÓóÌÐò¶¼Ê¹ÓÃÇëÇó/ÏìӦģÐÍ´Ó·þÎñÆ÷ÉÏ»ñµÃÍêÕûµÄ HTML Ò³Ãæ¡£³£³£Êǵã»÷Ò»¸ö°´Å¥£¬µÈ´ý·þÎñÆ÷ÏìÓ¦£¬ÔÙµã»÷ÁíÒ»¸ö°´Å¥£¬È»ºóÔٵȴý£¬ÕâÑùÒ»¸ö·´¸´µÄ¹ý³Ì¡£ÓÐÁË Ajax ºÍ XMLHttpRequest ¶ÔÏ󣬾ͿÉÒÔʹÓò»±ØÈÃÓû§µÈ´ý·þÎñÆ÷ÏìÓ¦µÄÇëÇó/ÏìӦģÐÍÁË¡£±¾ÎÄÖУ¬Brett McLaughlin ½éÉÜÁËÈçºÎ´´½¨Äܹ»ÊÊÓ¦²»Í¬ä¯ÀÀÆ÷µÄ ......
AjaxµÄÔÀí¼òµ¥À´ËµÍ¨¹ýXmlHttpRequest¶ÔÏóÀ´Ïò·þÎñÆ÷·¢Òì²½ÇëÇ󣬴ӷþÎñÆ÷»ñµÃÊý¾Ý£¬È»ºóÓÃjavascriptÀ´²Ù×÷DOM¶ø¸üÐÂÒ³Ãæ¡£ÕâÆäÖÐ×î¹Ø¼üµÄÒ»²½¾ÍÊÇ´Ó·þÎñÆ÷»ñµÃÇëÇóÊý¾Ý¡£ÒªÇå³þÕâ¸ö¹ý³ÌºÍÔÀí£¬ÎÒÃDZØÐë¶Ô XMLHttpRequestÓÐËùÁ˽⡣
XMLHttpRequestÊÇajaxµÄºËÐÄ»úÖÆ£¬ËüÊÇÔÚIE5ÖÐÊ×ÏÈÒýÈëµÄ£¬ÊÇÒ»ÖÖÖ§³ÖÒì²½ÇëÇóµÄ¼¼Êõ ......
ÔÚÒ»¸öСÐÍÏîÄ¿ÖУ¬ÎÒʹÓÃÁËAjax ExtensionsÖеÄUpdatePanel¿Ø¼þ£¬ÔÚ±¾µØµ÷ÊÔÔËÐÐʱºÃµÄ£¬¿ÉÒÔ¿´µ½ajaxµÄÒ첽ˢÐÂЧ¹û£¬µ«Êǵ±·¢²¼µ½°²×°ÁË.net framework 3.5 sp1µÄserver 2003ÉÏÈ¥Ö®ºó£¬·¢ÏÖajaxЧ¹ûûÓÐÁË£¬Ò²¾ÍÊÇ˵±¾À´µÄÒì²½Ìá½»±ä³ÉÁË·ÇAjax·½Ê½µÄPOST£¬¶øÇÒûÓб¨¸æÈκδíÎó¡£
¶Ô±È¿ª·¢Ê±ºÍÔËÐÐ ......