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

AJAX+jspÎÞË¢ÐÂÑéÖ¤ÂëʵÀý

[list=1]
ÎÒÃÇÔÚ×öÑéÖ¤ÂëµÄʱºòÍùÍùÓÉÓÚÒª·´×÷±×£¬ÑéÖ¤ÓÐʱ¹ÊÒâ¼ÓÈë¶àµÄ¸ÉÈÅÒòËØ£¬ÕâʱÑéÖ¤ÂëÏÔʾ²»ºÜÇå³þ£¬Óû§¾­³£ÊäÈë´íÎó¡£ÕâÑù²»µ«ÒªÖØÐÂË¢ÐÂÒ³Ã棬µ¼ÖÂÓû§Ã»Óп´Çå³þÑéÖ¤Âë¶øÖØÌî¶ø²»ÊÇÐ޸ģ¬¶øÇÒÈç¹ûûÓÐÓÃsession±£´æÏÂÓû§ÊäÈëµÄÆäËüÊý¾ÝµÄ»°(ÈçÐÕÃû)£¬Óû§¸Õ¸ÕÊäÈëµÄÄÚÈÝÒ²²»´æÔÚÁË£¬ÕâÑù¸øÓû§Ôì³É²»ºÃµÄÌåÑé¡£
±¾ÀýÔÚÔ­ÓÐÑéÖ¤·½Ê½»ù´¡Ö®ÉÏÔö¼ÓÒ»¶Îjs£¬Í¨¹ýxmlhttpÀ´»ñÈ¡·µ»ØÖµ£¬ÒÔ´ËÀ´ÑéÖ¤ÊÇ·ñÓÐЧ£¬ÕâÑù¼´Ê¹Óû§ä¯ÀÀÆ÷²»Ö§³Öjs£¬Ò²²»»áÓ°ÏìËûµÄÕý³£Ê¹ÓÃÁË¡£
ΪÁË·ÀÖ¹×÷±×£¬µ±Óû§Á¬½Ó3´ÎÊäÈë´íÎóʱÔòÖØÔØÒ»ÏÂͼƬ£¬ÕâÑùÒ²ÀûÓÚÓû§ÒòΪͼƬÉϵÄÑéÖ¤Âë±æÈϲ»Çå¶øʹÖÕÎÞ·¨ÊäÈëÕýÈ·¡£
±¾Àý»¹ÌرðÊʺϼìÑéÓû§ÃûÊÇ·ñÓÐЧ£¬Ö»Òª´Óºǫ́×ö¸ösql²éѯ£¬·µ»ØÒ»¸öÖµ»òÊÇxml¼´¿É¡£(ÕâÖÖÀý×ÓÌ«¶à £¬¾ÍÔڴ˲»×¸ÊöÁË)¡£
±¾ÀýµÄÓŵãÔÚÓڷdz£·½±ãÓû§ÊäÈ룬¶øÇÒ¼õÉÙ¶Ô·þÎñÆ÷¶ËµÄÇëÇ󣬿ÉÒÔ˵¼È¸ÄÉÆÓû§ÌåÑé¶øÇÒÂÔ»á½ÚÊ¡´ø¿í³É±¾£¬µ«ÏàÓ¦µØÒªÔÚÒ³ÃæÉÏÔö¼ÓÒ»¶ÎJavaScript´úÂ룬ÔÚÄ¿Ç°ÍøËÙÔ½À´Ô½¿ìÈËÃÇÒªÇó±ã½ÝÊæÊʵĽñÌ죬ËƺõÎÒÃǸüӦעÒâÌṩ¸øÓû§Á¼ºÃµÄʹÓøÐÊÜ¡£ ´úÂëÈçÏ£¬
1,img.jsp,ÊäÈëÖ÷Ò³Ãæ
<%@ page contentType="text/html; charset=GBK" language="java" import="java.sql.*" errorPage="" pageEncoding="GBK"%>
<%
//set Chinese Char
//Cody by JarryLi@gmail.com;
//homepage:jiarry.126.com
request.setCharacterEncoding("GBK");
response.setCharacterEncoding("GBK");
response.setContentType("text/html; charset=GBK");
%>
<html>
<head>
<title>ͼƬÑéÖ¤</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script src="net.js"></script>
</head>
<body>
AJAX(ÎÞˢм°Ê±Ìáʾ)ÑéÖ¤ÂëʵÀý£¡cody by jarry
<hr>
<%
String num=request.getParameter("num");
String random=(String)session.getAttribute("random");
String name=request.getParameter("name");
if(num!=null&&random!=null&&name!=null)
{
if(num.equals(random))
{
  out.println("<font style=\"color:green;font-weight:bold\">¹§Ï²Äú£¬ÑéÖ¤ÂëÊäÈë³É¹¦£¬ÕâÀïÊÇÌá½»½á¹ûÒ³Ã棬¿ÉÒÔдÈëÊý¾Ý¿âÁË£¡</font> <a href=\"img.jsp\">·µ»ØÔÙ²âÊÔ</a><br>");
&nb


Ïà¹ØÎĵµ£º

jsp Servlet ´¦Àí±íµ¥Êý¾Ý

4.1 ±íµ¥Êý¾Ý¸ÅÊö
¡¡¡¡ Èç¹ûÄãÔø¾­Ê¹ÓùýWebËÑË÷ÒýÇ棬»òÕßä¯ÀÀ¹ýÔÚÏßÊéµê¡¢¹ÉƱ¼Û¸ñ¡¢»úƱÐÅÏ¢£¬»òÐí»áÁôÒ⵽һЩ¹Å¹ÖµÄURL£¬±ÈÈç“http://host/path?user=Marty+Hall&origin=bwi&dest=lax”¡£Õâ¸öURLÖÐλÓÚÎʺźóÃæµÄ²¿·Ö£¬¼´“user=Marty+Hall&origin=bwi&dest=lax”£¬¾ÍÊÇ±íµ¥Êý ......

JSPÖж¯Ì¬INCLUDEÓ뾲̬INCLUDEµÄÇø±ð

ÎÒÃǶ¼ÖªµÀÔÚjspÖÐincludeÓÐÁ½ÖÖÐÎʽ,·Ö±ðÊÇ
    <%@ include file=" "%>
    <jsp:include page=" " flush="true"/>
    Ç°ÕßÊÇÖ¸ÁîÔªËØ¡¢ºóÕßÊÇÐÐΪԪËØ.
    ͨ³£µ±Ó¦ÓóÌÐòÖÐËùÓеÄÒ³ÃæµÄijЩ²¿·Ö(ÀýÈç±êÌâ¡¢Ò³½ÅºÍµ¼º½À¸)¶¼ÏàͬµÄʱºò,Î ......

ʵÀý½âÎö ÔÚEclipse3.2Éϲ¿ÊðJSPÈ«¹ý³Ì

Ò»¡¢ÏÂÔØ
J2SDK£ºjdk-1_5_0_04-windows-i586-p.exe
ECLIPSE£ºeclipse-SDK-3.2-win32.zip
ECLIPSE ²å¼þ£º
(1)ÖÐÎÄ°ü NLpack1-eclipse-SDK-3.2-win32.zip
(2)Tomcat²å¼þ tomcatPluginV31.zip
(3)LOMBAT£ºlomboz-wtp-emf-gef-jem-3.1.2.zip
TOMCAT£ºapache-tomcat-5.5.17.exe
mysql£ºMysql-5.0.15.rar
¶þ¡¢°²×°
1.°² ......

JSP¿¼µã×ܽá

1£¬JSPÖж¯Ì¬INCLUDEÓ뾲̬INCLUDEµÄÇø±ð£¿
¶¯Ì¬INCLUDEÓÃjsp:include¶¯×÷ʵÏÖ <jsp:include page="included.jsp" flush="true" />Ëü×ÜÊÇ»á¼ì²éËùº¬ÎļþÖеı仯£¬ÊʺÏÓÃÓÚ°üº¬¶¯Ì¬Ò³Ã棬²¢ÇÒ¿ÉÒÔ´ø²ÎÊý¡£    
####Õâ¸öÊÇ°ÑÒýÓõÄjsp±àÒë³ÉservletÒÔºó£¬Ö±½Óµ÷ÓÃservletÀàµÄ×ö·¨¡£####
¾²Ì¬INCLUDEÓÃinc ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ