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

JSPÁ¬½ÓÊý¾Ý¿âµÄ×ܽá

ÒòΪÊǸú×ÅÊÓƵѧϰµÄ£¬ÓкܶàÓõĶ«Î÷²»Ò»Ñù£¬µ«ÊÇ»¹ÊÇÂýÂýµÄÃþË÷³öÀ´À²£¡
1.Microsoft JDBC Driver µÄÏÂÔØ°²×°
 Ö»ÒªÔÚÍøÉÏÕÒµ½×ÊÔ´Ò»²½²½À´¾Í¿ÉÒÔÁË¡£
2.ÅäÖû·¾³±äÁ¿
  ÎÒÓõÄÊÇtomcat6.0Ê×ÏÈÅäµÄÊÇ
classpathºÍpath£¬ÕâЩ¶¼ÊÇÔÚÅäjdkµÄʱºò¾ÍÅä¹ýÁË£¬ËùÒԾͲ»Ïêϸ˵Ã÷ÁË£¬Ö»Òª½«libºÍbinÎļþ¼ÓÈëµ½Ïà¹ØµÄ·¾¶Ï¾ͿÉÒÔÁË¡£
ÁíÍâµÄÒ»¸öÎÊÌâ¾ÍÊÇ¿ÉÄÜ»á³öÏÖNeither the JAVA_HOME nor the JRE_HOME environment variable is defined
At least one of these environment variable is needed to run this program
Ò»¸öÕâÑùµÄÎÊÌ⣬ÕâÊÇÒòΪÏÖÔÚµÄjdk°æ±¾²»»á×Ô¶¯µÄ¼ÓÔØÕâÁ½¸ö¶«Î÷ÁË£¬½â¾ö°ì·¨£º
Ö»ÒªÔÚsetclasspathÖÐÈçÏÂÉèÖþͿÉÒÔÁË
rem ---------------------------------------------------------------------------
rem Set CLASSPATH and Java options
rem
rem $Id: setclasspath.bat 505241 2007-02-09 10:22:58Z jfclere $
rem ---------------------------------------------------------------------------
set JAVA_HOME=D:\Java\jdk1.6.0_11
set JRE_HOME=D:\Java\jre6 
 
rem Make sure prerequisite environment variables are set
if not "%JAVA_HOME%" == "" goto gotJdkHome
if not "%JRE_HOME%" == "" goto gotJreHome
echo Neither the JAVA_HOME nor the JRE_HOME environment variable is defined
echo At least one of these environment variable is needed to run this program
goto exit
......
3.µ¼ÈëÏàÓ¦µÄjar°ü£º
ÓÉÓÚÓõÄÊǼ¯³ÉµÄ¿ª·¢»·¾³£¬ËùÒÔÏà¶ÔÀ´Ëµ±È½ÏµÄ¼òµ¥¡£
Ö»ÒªÔÚwebContentϵÄlibÎļþ¼Ðϵ¼ÈëÎÒÃǵÄjdbcµÄjar°ü¾Í¿ÉÒÔÁË¡£
4.Á¬½ÓSQL Server 2005 µÄjsp´úÂ룺
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
String url="jdbc:sqlserver://10.1.0.10:1433;database=bbs";
String user="sa";
String pwd="123";
Connection conn=DriverManager.getConnection(url,user,pwd);
Statement stmt=conn.createStatement();
ResultSet rs=stmt.executeQuery("select * from dbo.article");
ÖÁÓÚÄãÒªÏÔʾʲôÄÚÈݾÍ×Ô¼º¿ØÖÆÁË£¬ÓÉÓÚÎÒÊÇÏÈÁ¬µÃÊý¾Ý¿â£¬Ã»ÓаѱíÃû·Å½øÈ¥£¬ºóÃæÁ¬½Ó¾ßÌåµÄ±íʱ£¬ÅªÁ˺þ᣺ÜÓôÃƵľÍÊÇ£¬Ã¿´ÎÎÊÌⶼ³öÔÚÕâЩÎÊÌâÉÏ£¬Ò»²»Ð¡ÐľÍÍü¼ÇÁËÈ¥Ìí¼ÓһЩ¶«Î÷£¡£¡£¡
¸öÈ˵ľ­Ñé×ܽ᣺¸Õ¿ªÊ¼Ñ§ÕâЩ¶«Î÷£¬ÒòΪûÓÐÕû¸öµ


Ïà¹ØÎĵµ£º

JSP¶ÁÎļþ´úÂë

<%@ page contentType="text/html; charset=gbk" language="java" import="java.io.*" buffer="64kb" %>
      <%
 
   String path_in = "";
   String content = "";
 
   path_in = request.getRealPath("/")+"admin"+File.separator+ ......

JSPдÎļþ´úÂë

<%@ page contentType="text/html; charset=gbk" language="java" import="java.sql.*" errorPage="" %>
<%@ page import="java.io.*" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w ......

jspÑéÖ¤Âë´úÂë

ÔÚ¿ª·¢ÖÐÑéÖ¤ÂëÊDZȽϳ£Óõ½ÓÐЧ·ÀÖ¹ÕâÖÖÎÊÌâ¶Ôijһ¸öÌض¨×¢²áÓû§ÓÃÌض¨³ÌÐòÆƽⷽʽ½øÐв»¶ÏµÄµÇ½³¢ÊԵķ½Ê½¡£
´ËÑÝʾ³ÌÐò°üÀ¨Èý¸öÎļþ£º
1.login.jsp:µÇ¼ҳÃæ
2.code.jsp:Éú³ÉÑéÖ¤ÂëͼƬҳÃæ
3.check.jsp:ÑéÖ¤½á¹û
code.jsp
 ³ÌÐò´úÂë ==================================================
<%@ page co ......

JSPÒ³ÃæÌøת´óÈ«

JSPÒ³ÃæÌøת´óÈ«
JSPÖеÄÌøת£º
(1). forward()·½·¨
    ʹÓõ½javax.servlet.RequestDispatcherÀà
    RequestDispatcher rd = getServletContext().getRequestDispatcher("url");
    rd.forward(requestVar,requestVar); //´«µÝservletµÄÈë¿Ú²ÎÊý
   ......

jsp—MySqlÖÆ×÷B/sµÇ½µÄºÃÀý×Ó Ñ§Ï°±Ê¼Ç

½¨Á¢Ìõ¼þÊ×ÏÈÒ»¶¨ÒªÈ·¶¨×Ô¼ºµÄmysql£¬tomcat,eclipseÁ¬½ÓÊÇÕýÈ·µÄ¡£
index.jspºÜ¼òµ¥£¬¾ÍÒ»¸öÌøת¡£
<%
response.sendRedirect("lg.jsp");
%>
lg.jsp ʵÏֵǼ¿ò¼Ü
<%@ page contentType="text/html; charset=utf-8" %>
<html>
<head>
<title>
login
</title>
</hea ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ