AjaxÅжÏä¯ÀÀÆ÷µÄ·½·¨×ܽá
Ê×ÏȰѴúÂë¸ø´ó¼Ò£¬ÏÂÃæÊǽâÊÍ
/**
* »ñµÃXMLHttpRequest¶ÔÏó
*/
function createXHR(){
var x=[function(){return new ActiveXObject("Msxm12.XMLHTTP");},function(){return xmhttp=new ActiveXObject("Microsoft.XMLHTTP");},
function(){return new XMLHttpRequest();}];
for (var i=0; i<x.length; i++) {
try {
return (x[i])();
} catch (e) {
}
};
}
·½·¨Ò»:
//´´½¨Ò»¸ö²¼¶ûÐͱäÁ¿,ÓÃÀ´¼ì²éÊÇ·ñΪºÏ·¨µÄIEʵÀý
var xmlreq = false;
//¼ì²éÊÇ·ñʹÓõÄÊÇIE
try {
//Èç¹ûJavaScriptµÄ°æ±¾´óÓÚ5
xmlreq = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e1) {
// Èç¹û²»ÊÇ,ÔòʹÓÃÀϰ汾µÄActiveX¶ÔÏóÀ´¼ì²é
try {
//Èç¹ûʹÓõÄÊÇIEä¯ÀÀÆ÷
xmlreq = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e2) {
// ·ñÔò¿Ï¶¨Ê¹ÓõÄÊÇ·ÇIEä¯ÀÀÆ÷
xmlreq=false;
}
}
}
//Èç¹ûʹÓõÄÊÇ·ÇIEä¯ÀÀÆ÷,Ôò´´½¨Ò»¸ö¸Ã¶ÔÏóµÄJavaSriptʵÀý
if(!xmlreq && typeof XMLHttpRequest!='undefined'){
xmlreq=new XMLHttpRequest();
}
·½·¨¶þ:
//´´½¨Ò»¸ö²¼¶ûÐͱäÁ¿,ÓÃÀ´¼ì²éÊÇ·ñΪºÏ·¨µÄIEʵÀý
var xmlreq = false;
//Èç¹ûActiveX¶ÔÏó¿ÉÓÃ,ÔòʹÓõĿ϶¨ÊÇIE
if (window.ActiveXObject) {
xmlreq = new ActiveXObject("Microsoft.XMLHTTP");
} else {
// ·ñÔò¿Ï¶¨Ê¹ÓÃJavaSript´¦Àí·½·¨
xmlreq=new XMLHttpRequest();
}
·½·¨Èý:
//´´½¨Ò»¸ö²¼¶ûÐͱäÁ¿,ÓÃÀ´¼ì²éÊÇ·ñΪºÏ·¨µÄIEʵÀý
var xmlreq = false;
//
if (window.XMLHttpRequest) {
// Èç¹ûʹÓõÄÊÇ·ÇIEä¯ÀÀÆ÷,Ôò´´½¨Ò»¸ö¸Ã¶ÔÏóµÄJavaSriptʵÀý
xmlreq = new XMLHttpRequest();
} else if (window.ActiveXObject) {
// Create XMLHttpRequest via MS ActiveX
try {
// Èç¹ûJavaScriptµÄ°æ±¾´óÓÚ5
xmlreq = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e1) {
Ïà¹ØÎĵµ£º
×î½ü±»Õâ¸öÎÊÌâÀ§»óÁËÒ»¶Îʱ¼ä
ÎÊÌâµÄÓÉÀ´ÊÇÕâÑùµÄ£º
ÔÚpageloadʼþÖУ¬ÓÐÒ»ÐÐÓï¾ä¶Ôthis.Title¸³Öµ£º this.Title = dir.name;
ÓÉdirµÄnameÈ¥¶¯Ì¬µÄÉú³ÉÍøÒ³µÄtitle
Õâô×ö²¢Ã»ÓÐʲôÎÊÌ⣬µ«ÊÇÒ»µ©½áºÏÁËajax£¬ÎÊÌâ¾Í³öÏÖÁË
ÓÐÐËȤµÄÅóÓÑ¿ÉÒÔ³¢ÊÔÒ»ÏÂ
ÔÚpageloadÖжÔthis.Title¸³Öµ£¬È»ºóÔÚbodyÖÐдһ¸öupdatepanel ......
Ajax(Asynchronous JavaScript and XML)ÊÇÒ»¸ö½áºÏÁËJava¼¼Êõ¡¢XML¡¢ÒÔ¼°JavaScriptµÄ±à³Ì¼¼Êõ£¬¿ÉÒÔÈÃÄã¹¹½¨»ùÓÚJava¼¼ÊõµÄWebÓ¦Ó㬲¢´òÆÆÁËʹÓÃÒ³ÃæÖØÔØµÄ¹ßÀý¡£
Ajax£¬Òì²½JavaScriptÓëXML£¬ÊÇʹÓÿͻ§¶Ë½Å±¾ÓëWeb·þÎñÆ÷½»»»Êý¾ÝµÄWebÓ¦Óÿª·¢·½·¨¡£ÕâÑù£¬WebÒ³Ãæ²»Óôò¶Ï½»»¥Á÷³Ì½øÐÐÖØÐ¼Ӳ㬾ͿÉÒÔ¶¯Ì¬µØ¸üС£Ê ......
ÎÒÔÚÉÏһƪÎÄÕÂÖÐʹÓÃÔʼjavascriptµÄ·½Ê½¹¹Ôìajaxµ÷Ó㬵«´ÓÈ«¾Ö¿´£¬²»½ö½ö´úÂëµÄÔĶÁÐԱȽϵͶøÇÒÒþ²Ø·¢Éú´íÎóµÄ¿ÉÄÜ£¬±ÈÈçÔÚÒ³Ãæ¼ÓÔØÊ±¾Í¸Ä±ädom½á¹¹£¬»¹ÒªÊ±¿Ì¹Ø×¢ä¯ÀÀÆ÷µÄ¼æÈÝÐÔ£¬¶øÊ¹ÓÃjQueryÎÒÃǽ«²»´æÔÚÀàËÆµÄÎÊÌ⣬´úÂëµÄ¿É¶ÁÐÔÒ²ÏÔÖøÌá¸ß£¬´úÂëÁ¿Ð¡£¬ÏÂÃæÊÇjQuery°æ±¾µÄjs²¿·Ö´úÂ룬ϣÍûÄܹ»¶Ô¶ÁÕß ......
¸Ã¿Ø¼þ¿ÉÒÔʵÏÖÔÚÒ³ÃæÖе¯³öÒ»¸ö´°¿Ú£¬Õâ¸ö´°¿Ú²»ÊÇÒ»¸öеÄä¯ÀÀÆ÷´°¿Ú£¬¶øÊÇÏâǶÔÚÒ³ÃæÖеÄÒ»¸ö²ã¡£
1 ´´½¨Ò»¸ölinkbutton£¬ÓÃÓÚµã»÷´ò¿ª´°¿Ú¡£
2 ÍÏÈëÒ»¸öpanel£¬Õâ¸ö¾ÍÊÇÎÒÃÇÒªµ¯³öµÄ´°¿Ú¡£ËüÒ²¿ÉÒÔÊÇÁ½¸öǶÌ×µÄpanel¡£Àý³ÌÉÏÊÇÕâÑù×öµÄ£¬»¹ÊÇûÓÐÃ÷°×ΪʲôÕâô×ö¡£
3 ÍÏÈëÒ»¸öModalPopupExtender¿Ø¼þ£¬ÔڸÿؼþµÄta ......
Java´úÂë
@Override
protected ModelAndView onSubmit(HttpServletRequest request, HttpServletResponse response, Object cmd,
BindException ex) {
&nb ......