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
Ïà¹ØÎĵµ£º
Ò»£ºÇ°¶Ëjs´úÂ룬Ö÷Òª¸ºÔð´´½¨ajaxºÍ¶¯Ì¬Éú³ÉÇøÓòÁбí
<script type="text/javascript">
//iʼÖÕÖ¸Ïò×îºóÒ»¸öselect
var i=1;
//´´½¨XMLHttpRequest¶ÔÏó
var XMLHttpReq;
&n ......
¸Ã¿Ø¼þ¿ÉÒÔʵÏÖÔÚÒ³ÃæÖе¯³öÒ»¸ö´°¿Ú£¬Õâ¸ö´°¿Ú²»ÊÇÒ»¸öеÄä¯ÀÀÆ÷´°¿Ú£¬¶øÊÇÏâǶÔÚÒ³ÃæÖеÄÒ»¸ö²ã¡£
1 ´´½¨Ò»¸ölinkbutton£¬ÓÃÓÚµã»÷´ò¿ª´°¿Ú¡£
2 ÍÏÈëÒ»¸öpanel£¬Õâ¸ö¾ÍÊÇÎÒÃÇÒªµ¯³öµÄ´°¿Ú¡£ËüÒ²¿ÉÒÔÊÇÁ½¸öǶÌ×µÄpanel¡£Àý³ÌÉÏÊÇÕâÑù×öµÄ£¬»¹ÊÇûÓÐÃ÷°×ΪʲôÕâô×ö¡£
3 ÍÏÈëÒ»¸öModalPopupExtender¿Ø¼þ£¬ÔڸÿؼþµÄta ......
¶àÊý Web Ó¦ÓóÌÐò¶¼Ê¹ÓÃÇëÇó/ÏìӦģÐÍ´Ó·þÎñÆ÷ÉÏ»ñµÃÍêÕûµÄ HTML Ò³Ãæ¡£³£³£Êǵã»÷Ò»¸ö°´Å¥£¬µÈ´ý·þÎñÆ÷ÏìÓ¦£¬ÔÙµã»÷ÁíÒ»¸ö°´Å¥£¬È»ºóÔٵȴý£¬ÕâÑùÒ»¸ö·´¸´µÄ¹ý³Ì¡£ÓÐÁË Ajax ºÍ XMLHttpRequest ¶ÔÏ󣬾ͿÉÒÔʹÓò»±ØÈÃÓû§µÈ´ý·þÎñÆ÷ÏìÓ¦µÄÇëÇó/ÏìӦģÐÍÁË¡£±¾ÎÄÖУ¬Brett McLaughlin ½éÉÜÁËÈçºÎ´´½¨Äܹ»ÊÊÓ¦²»Í¬ä¯ÀÀÆ÷µÄ ......
ÔÚ HTML µÄÍⲿÎļþÖÐÒ»Ñù£¬±ê¼ÇµÄ×éÖ¯ÓëÆäÑùʽ¡¢¸ñʽºÍÐÐΪÊÇ·ÖÀëµÄ¡£ËäÈ»Äú¿Ï¶¨¿ÉÒÔÓà JavaScript ¸ü¸ÄÔªËØ»òÎı¾µÄÑùʽ£¬µ«Êµ¼Ê¸ü¸ÄÄúµÄ±ê¼ÇËù²¼ÖõÄ×é֯ȴ¸ü¼ÓÓÐȤ¡£
Ö»ÒªÀμÇÄúµÄ±ê¼ÇֻΪÄúµÄÒ³ÃæÌṩ×éÖ¯¡¢¿ò¼Ü£¬Äú¾ÍÄÜÁ¢ÓÚ²»°ÜÖ®µØ¡£ÔÙÇ°½øһС²½£¬Äú¾Í»áÃ÷°×ä¯ÀÀÆ÷ÊÇÈçºÎ½ÓÊÜËùÓеÄÎı¾×éÖ¯²¢½«Æäת±äΪ³¬¼¶ÓÐȤµ ......