Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö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ͨ¹ýdivʵÏÖ¸²¸Ç£¬µ¯³öд°Ìå

<body style="height:100%;">
-------------------------------------------------------------------Ò»¿ªÊ¼µÄÒ³Ãæ----------------------
fdasfsdfadf
<input name="button2" onclick="ShopConfirm('fdsaf')" value="µãÎÒ" type="button"/>
--------------------------------------------------------- ......

jspµÇ¼ÑéÖ¤´úÂë


image.jspÓÃÓÚÉú³ÉÊý×ÖͼƬ
<%@ page contentType="image/jpeg;charset=gb2312" import="java.awt.*,
java.awt.image.*,java.util.*,javax.imageio.*" %>
<%!
Color getRandColor(int fc,int bc){//¸ø¶¨·¶Î§»ñµÃËæ»úÑÕÉ«
          Random random = new Rand ......

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

JSPÒ³ÃæÌøת´óÈ«
JSPÖеÄÌøת£º
(1). forward()·½·¨
    ʹÓõ½javax.servlet.RequestDispatcherÀà
    RequestDispatcher rd = getServletContext().getRequestDispatcher("url");
    rd.forward(requestVar,requestVar); //´«µÝservletµÄÈë¿Ú²ÎÊý
   ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ