Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

¼òµ¥AjaxÓëJSPÏà½áºÏÒ³Ãæ

»·¾³£ºAjax+JSP£¬Tomcat5.05
²Î¿¼£ºhttp://www.w3cschool.cn/index-24.asp.htm
Îļþ£ºtestAjax.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=gb2312">
<title>ÎÞ±êÌâÎĵµ</title>
</head>
<body>
<mce:script type="text/javascript"><!--
function ajaxFunction(){
var xmlHttp;
try{
// Firefox, Opera 8.0+, Safari
xmlHttp=new XMLHttpRequest();
}catch (e){
// Internet Explorer
try{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}catch (e){
try{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}catch (e){
alert("ÄúµÄä¯ÀÀÆ÷²»Ö§³ÖAJAX£¡");
return false;
}
}
}
xmlHttp.onreadystatechange=function(){
if(xmlHttp.readyState==4){
document.myForm.time.value=xmlHttp.responseText;
}
}
xmlHttp.open("GET","time.jsp",true);
xmlHttp.send(null);
}
function clearText(){
document.myForm.time.value="";
}
// --></mce:script>
<form name="myForm">
Óû§: <input type="text" name="username" onMouseOver="ajaxFunction()" onMouseOut="clearText()" size="50">
<p>
ʱ¼ä: <textarea name="time" rows="5" cols="50"> 
time.jsp
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>ÎÞ±êÌâÎĵµ</title>
</head>
<body>
<%
java.io.PrintWriter myOut = response.getWriter();
java.util.Date d = new java.util.Date();
java.text.SimpleDateFormat f = new java.text.SimpleDateFormat("yyyyÄêMMÔÂddÈÕ hh:mm:ss");
myOut.print(f.format(d));
myOut.flush();
my


Ïà¹ØÎĵµ£º

ajax¾Ö²¿Ìá½»

ʵÏÖ¹¦ÄÜ£ºµ¥»÷°´Å¥£¬½«´ÓÊý¾Ý¿â»ñÈ¡µÄÊý¾Ý·µ»Ø¸øÎı¾¿ò1(Ë¢ÐÂÎı¾¿ò1)£¬¶øÎı¾¿ò2²»Ë¢ÐÂ
Ò³Ãæ1£ºtest.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head ......

´Ójdk°²×°µ½jspÁ¬½ÓoracleÊý¾Ý¿âµÄÏà¹ØÅäÖÃ

1.°²×°jdk(°æ±¾6u7);
¡¡¡¡2.ÅäÖÃjdk»·¾³±äÁ¿(°²×°Ä¿Â¼:D:\tools\java\jdk1.6.0_07):
¡¡¡¡1). JAVA_HOME = D:\tools\java\jdk1.6.0_07;
¡¡¡¡2). PathµÄ×îÇ°Ãæ×·¼Ó"D:\tools\java\jdk1.6.0_07\bin;D:\tools\java\jre1.6.0_07\bin";
¡¡¡¡3). CLASSPATH = D:\tools\java\jdk1.6.0_07\lib;D:\tools\java\jdk1.6.0_07\lib\too ......

JSPÔÚÏ߱༭Æ÷

 ±¾Àý×ÓÔÚWindows+Tomcat6(weblogic9.2)+jdk1.6ÏÂÔËÐС£
1£©°²×°ºÃjdk1.6£¬È»ºó°²×°tomcat6.
2£©ÔÚtomcatĿ¼µÄconfĿ¼Ï£¬ÐÞ¸Äserver.xml¡£
 ±¾Àý×ÓÊÇĬÈÏÅäÖÃÔËÐÐÔÚÐéÄâĿ¼Ï£¬,²¢ÇÒÉÏ´«»ù׼Ŀ¼µÄÎïÀí·¾¶ÔÚµ±Ç°Ó¦ÓÃÏ¡£Çë¸ù¾ÝµÚ3µã£¬ÔÚ¶ÔÓ¦µÄhost½ÚµãÉϼÓÈëÀ¶É«²¿·Ö´úÂë¡£
1£©Èç¹ûÓ¦Óò¿ÊðÔÚÍøÕ¾¸ùĿ¼ ......

Jsp±à³Ì

 JAVA×ÛºÏÃæÊÔÌ⣺ҳÃæµÄץȡ¡¢½âÎö¡¢±£´æÊý¾Ý¿âºÍÉú³ÉHTMLµÄÒ³Ãæչʾ ÊÕ²Ø
´ÎÀý×Ó¿ÉÒÔÓÃÀ´Ñ§Ï°ÍøÂç±à³Ì£¬ÕýÔò±í´ïʽµÄʹÓ㬷ºÐÍ£¬Êý¾Ý¿âµÄ»ù±¾²Ù×÷µÈJAVA֪ʶ
ÎÊÌâÈçÏ£ºÀ´Ô´ÓÚÂÛ̳
http://topic.csdn.net/u/20090616/13/59aa4e2d-3752-45df-9c1b-c65c46c3e4d7.html
дһ¸öjspÒ³Ã棬·ÃÎÊʱÏÔʾ´ÓÏÂÃæµÄÒ³ÃæÌ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ