JAVA AJAX½Ì³ÌµÚËÄÕ—AJAXºÍMVCµÄ¼òµ¥½áºÏ
ÕâÀïÎÒÃÇÔÙÀí½âÁËAJAXºó£¬¿ªÊ¼À´ÓÃʵÀý¸ÐÊÜAJAXµÄÁ¦Á¿¡£
½ñÌìÎÒ×îºóҪʵÏÖµÄЧ¹û£¬µ±Êó±ê·Åµ½Í¼Æ¬ÉÏʱ»á¸ù¾Ý£¬»á°ÑÊý¾Ý¿â¿âÀïµÄÊý¾Ý¶Á³ö£¬Í¨¹ýÏÔʾ¿òÏÔʾ³öÀ´¡£Õâ¸öÔںܶàÍøÉÏÉ̵궼ÓÐÓõ½ÕâÀïЧ¹û£¬ÎÒÃÇÕâÀïÓÃAJAXÀ´ÊµÏÖÕâ¸öЧ¹û¡£Õâ¸öʵÀýÀï½áºÏÁËMySql¡¢Servlet»¹ÓÐJs£¬ÀíÂÛÐÔºÜÉÙ£¬µ«Í¨¹ýʵ¼ùÀ´¸ÐÊÜÀíÂÛ֪ʶ¡£
Ò»¸öÒ³ÃæÖÐÓ¦ÓÃÁËAJAX£¬Í¬Ê±ËûÒ²ÄÜʵÏÖMVC¿ò¼Ü£¬¿ÉÒÔÂ𣿵±È»¿ÉÒԵġ£Í¨¹ýÒ³Ãæµ÷ÓÃAJAX£¬Õâ¸öÒ³Ãæ¾ÍÊÇMVCÖеÄV£¬ËûÓÃÀ´Ç°Ì¨ÏÔʾÓëÓû§½»»¥µÄÄÚÈÝ¡£ÓÃJavaBean×÷ΪMVCÖеÄM£¬À´·âװһЩÎÒÃÇÐèÒªµÄ¹¦ÄܺÍÊý¾Ý£¬ÕâÑù±ãÓÚC½«ÐÅÏ¢´«¸øV¡£ÕâÀï¾ÍÇ£Éæµ½C£¬Ê²Ã´ÊÇCÄØ£¬ÕâÀïÎÒÃÇÔÚModel2ÖеÄC¾ÍÊÇServlet£¬ËûÓÃÀ´¶Ô¾ßÌåµÄÊÂÇé½øÐпØÖÆ¡£M-V-C¶¼ÆëÈ«ÁË£¬ÕâÑùÎÒÃǾÍÍê³ÉÒ»¸öMVCÁË¡£ÔÚÏÂÃæµÄÎļþ½á¹¹ÖУ¬ÈÃÎÒ¸øÄãÖ¸³öÄÄЩÊÇM-V-C¡£main.htmlºÍlogin.jspÊÇV£¬DB.javaºÍProduct.javaÊÇJavaBeanÒ²¾ÍÊÇM£¬¶øLoginAction.javaºÍTipServlet.javaÊÇC£¬ÏÂÃæ¾ÍÀ´¿´¿´ÈçºÎ°ÑAJAXºÍMVC½áºÏÆðÀ´¡£
ÕâÀïÊÇÎÒÃǵÄÎļþ½á¹¹£¬ÎÒÃÇÐèÒªÒ»¸öÒ³Ãæmain.htmlÀ´³ÐÔØǰ̨£»Ò»¸öÊý¾Ý¿âÊý¾ÝÀ´´æ´¢ÎÒÃǵÄÉ豸£»ÓÉÓÚÕâÀﻹÊÇ»ùÓÚMVC¿ò¼ÜÀ´×öµÄ£¬ËùÒÔ³ýÁËÒ³ÃæÍ⣬ÎÒÃÇ»¹ÐèÒªServletÀ´ÊµÏÖ¾ßÌåµÄ¹¦ÄÜ£¬DB.java¡¢Product.javaºÍTipServlet.javaÀà¡£ÏêϸµÄ×¢ÊÍдÔÚ´úÂ룬ÕâÑù·½±ãÀí½âºÍ²é¿´¡£
ÎÒÃÇÏÈÀ´¿´main.html´úÂë(ÏêϸעÊÍдÔÚ´úÂë)£º
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script type="text/javascript">
//¶¨ÒåÏÔʾ¿ò
var datadiv;
var datatablebody;
//µ±Ç°DOM½Úµã
var curelement;
var XMLHttpReq = false;
//´´½¨XMLHttpRequest¶ÔÏó
function createXMLHttpRequest(){
if(window.XMLHttpRequest){
XMLHttpReq = new XMLHttpRequest();
}else if(window.ActiveXObject){
try{
XMLHttpReq = new ActiveXObject("MSXML2.XMLHTTP");
}catch(e){
try{
XMLHttpReq = new ActiveXObject("Mircsoft.XMLHTTP");
}catch(e1){}
}
}
}
//·¢ËÍÇëÇóº¯Êý
function getdatail(element){
datatablebody = document.getElementById("databody");
datadiv = document.getElementById("popup");
createXMLHttpRequest();
curelement = element;
var url
Ïà¹ØÎĵµ£º
JavaÓïÑÔÒýÈëÁËJavaÐéÄâ»ú£¬¾ßÓпçƽ̨ÔËÐеŦÄÜ£¬Äܹ»ºÜºÃµØÊÊÓ¦¸÷ÖÖWebÓ¦Óá£Í¬Ê±£¬ÎªÁËÌá¸ßJavaÓïÑÔµÄÐÔÄܺͽ¡×³ÐÔ£¬»¹ÒýÈëÁËÈçÀ¬»ø»ØÊÕ»úÖƵÈй¦ÄÜ£¬Í¨¹ýÕâЩ¸Ä½øÈÃJava¾ßÓÐÆä¶ÀÌصŤ×÷ÔÀí¡£
1£®JavaÐéÄâ»ú
JavaÐéÄâ»ú£¨Java Virtual Machine£¬JVM£©ÊÇÈí¼þÄ£ÄâµÄ¼ÆËã»ú£¬Ëü¿ÉÒÔÔÚÈκδ¦ÀíÆ÷ÉÏ£¨ÎÞÂÛÊÇÔÚ¼ÆËã»úÖл ......
ÔÚJAVAÖУº
1. º¯ÊýÖØÔØÊÇÒ»¸öÀàÖÐÉùÃ÷Á˶à¸öͬÃûµÄ·½·¨£¬µ«Óв»Í¬µÄ²ÎÊý¸öÊýºÍ²ÎÊýÀàÐÍ¡£
2. º¯ÊýÖع¹ÊÇÖ¸ÔÚ×ÓÀàÖÐÉùÃ÷Ó븸ÀàͬÃûµÄ·½·¨£¬´Ó¶ø¸²¸ÇÁ˸¸ÀàµÄ·½·¨¡£Öع¹½â¾öÁË×ÓÀàÓ븸ÀàµÄ²îÒìÎÊÌâ¡£
Àý×ÓÈçÏ£º
//ÖØÔØ
class A {
public d (){};
public d (q){};
public d (q,w){};
}
//ÖØд ......
from: http://blog.csdn.net/WOSHISUNXIANGFU/archive/2008/08/25/2828634.aspx
1.½éÉÜ
1£©DOM£¨JAXP Crimson½âÎöÆ÷£©
DOMÊÇÓÃÓëƽ̨ºÍÓïÑÔÎ޹صķ½Ê½±íʾXMLÎĵµµÄ¹Ù·½W3C±ê×¼¡£DOMÊÇÒÔ²ã´Î½á¹¹×éÖ¯µÄ½Úµã»òÐÅϢƬ¶ÏµÄ¼¯ºÏ¡£Õâ¸ö²ã´Î½á¹¹ÔÊÐí¿ª·¢ÈËÔ±ÔÚÊ÷ÖÐÑ°ÕÒÌض¨ÐÅÏ¢¡£·ÖÎö¸Ã½á¹¹Í¨³£ÐèÒª¼ÓÔØÕû¸öÎĵµ ......