JSP¾Å´óÄÚÖöÔÏó¼°Ëĸö×÷ÓÃÓò
¾Å´ó¶ÔÏó£º
ÄÚÖöÔÏó£¨ÓÖ½ÐÒþº¬¶ÔÏó£¬ÓÐ9¸öÄÚÖöÔÏó£©:²»ÐèÒªÔ¤ÏÈÉùÃ÷¾Í¿ÉÒÔÔڽű¾´úÂëºÍ±í´ïʽÖÐËæÒâʹÓÃ
1-out:
javax.servlet.jsp.JspWriterÀàÐÍ£¬´ú±íÊä³öÁ÷µÄ¶ÔÏó¡£×÷ÓÃÓòΪpage£¨Ò³ÃæÖ´ÐÐÆÚ£©
request£ºjavax.servlet.ServletRequestµÄ×ÓÀàÐÍ£¬´Ë¶ÔÏó·â×°ÁËÓÉWEBä¯ÀÀÆ÷»òÆäËü¿Í»§¶ËÉú³ÉµØHTTP
ÇëÇóµÄϸ½Ú£¨²ÎÊý£¬ÊôÐÔ£¬Í·±êºÍÊý¾Ý£©¡£×÷ÓÃÓòΪrequest(Óû§ÇëÇóÆÚ£©¡£
·½·¨Óɿɲ鿴API
response£ºjavax.servlet.ServletResponseµÄ×ÓÀàÐÍ£¬´Ë¶ÔÏó·â×°ÁË·µ»Øµ½HTTP¿Í»§¶ËµÄÊä³ö£¬ÏòÒ³Ãæ
×÷ÕßÌṩÉèÖÃÏìӦͷ±êºÍ״̬ÂëµÄ·½Ê½¡£¾³£ÓÃÀ´ÉèÖÃHTTP±êÌ⣬Ìí¼Ócookie£¬ÉèÖÃÏìÓ¦ÄÚÈݵÄÀàÐͺÍ×´
̬£¬·¢ËÍHTTPÖض¨ÏòºÍ±àÂëURL¡£×÷ÓÃÓòΪpage£¨Ò³ÃæÖ´ÐÐÆÚ£©¡£
pageContext£ºjavax.servlet.jsp.PageContext£¨³éÏóÀࣩÀàÐÍ£¬×÷ÓÃÓòΪpage£¨Ò³ÃæÖ´ÐÐÆÚ£©¡£´Ë¶ÔÏó
ÌṩËùÓÐËĸö×÷ÓÃÓò²ã´ÎµÄÊôÐÔ²éѯºÍÐÞ¸ÄÄÜÁ¦£¬ËüÒ²ÌṩÁËת·¢ÇëÇóµ½ÆäËü×ÊÔ´ºÍ°üº¬ÆäËû×ÊÔ´µÄ·½·¨
£º
¸Ã¶ÔÏóµÄ·½·¨¶¼ÊdzéÏó·½·¨
session£ºjavax.servlet.http.HttpSessionÀàÐÍ£¬Ö÷ÒªÓÃÓÚ¸ú×Ù¶Ô»°¡£×÷ÓÃÓòsession(»á»°ÆÚ—£©¡£
HttpSessionÊÇÒ»¸öÀàËƹþÏ£±íµÄÓëµ¥Ò»WEBä¯ÀÀÆ÷»á»°Ïà¹ØµÄ¶ÔÏó£¬Ëü´æÔÚÓÚHTTPÇëÇóÖ®¼ä£¬¿ÉÒÔ´æ´¢ÈÎ
ºÎÀàÐ͵ÄÃüÃû¶ÔÏó¡£
Èç¹û²»ÐèÒªÔÚÇëÇóÖ®¼ä¸ú×ٻỰ¶ÔÏ󣬿ÉÒÔͨ¹ýÔÚpageÖ¸ÁîÖÐÖ¸¶¨session="false"
ÐèÒª¼ÇסµÄÊÇpageContext¶ÔÏóÒ²¿ÉÒÔÓësession.getAttribute(),session.setAttribute()Ò»ÑùµÄ·½Ê½È¡
µÃ²¢ÉèÖûỰÊôÐÔ¡£
application£ºjavax.servlet.ServletContextÀàÐÍ£¬servletµÄ»·¾³Í¨¹ýµ÷ÓÃgetServletConfig
().getContext()·½·¨»ñµÃ¡£×÷ÓÃÓòÊÇapplication(Õû¸ö³ÌÐòÔËÐÐÆÚ£©¡£ËüÌṩÁ˹ØÓÚ·þÎñÆ÷°æ±¾£¬Ó¦ÓÃ
¼¶³õʼ»¯²ÎÊýºÍÓ¦ÓÃÄÚ×ÊÔ´¾ø¶Ô·¾¶£¬×¢²áÐÅÏ¢µÄ·½Ê½
config£ºjavax.servlet.ServletConfig,×÷ÓÃÓòΪpage£¨Ò³ÃæÖ´ÐÐÆÚ£©
exception:java.lang.Throwable,ͨ¹ýJSP´íÎóÒ³ÃæÖÐÒ»¸öcatch¿éÒѾÒæ³öµ«Ã»ÓⶻñµÄ
java.lang.ThrowableµÄÈÎÒâʵÀý£¬´«ÏòÁËerrorPageµÄURI¡£×÷ÓÃÓòΪpage£¨Ò³ÃæÖ´ÐÐÆÚ£©¡£×¢Òâ
exceptionÖ»ÓÐÔÚpageÖ¸ÁîÖоßÓÐÊôÐÔisErrorPage="true"ʱ²ÅÓÐЧ¡£
page:java.lang.ObjectÀàÐÍ£¬Ö¸ÏòÒ³Ãæ×ÔÉíµÄ·½Ê½¡£×÷ÓÃÓòΪpage£¨Ò³ÃæÖ´ÐÐÆÚ
JSPÖоŴóÄÚÖöÔÏóΪ£º
request ÇëÇó¶ÔÏó¡¡  
Ïà¹ØÎĵµ£º
×î½üÔÚѧJAVA£¬Á·Ï°µÄʱºòÓöµ½¸öÎÊÌ⣬Çë´ó¼Ò°ïæ¿´¿´……
Ö÷ÒªÎÊÌâÊÇ£¬ÔÚJSPÖÐûÓа취µ¼ÈëÎÒÏëÓõÄÀ࣬Ã÷Ã÷µ¼ÈëÁË°ü£¬È´±¨£ºMyDAO cannot be resolved to a type
JSP´úÂ룺
<%@ page contentType="text/html;charset=GBK"%>
<%@ page import="java.util.Date"%>
<%@ page import="java.t ......
jspÁ¬½Ósql server2005
£¨¾²âÊÔÁ¬½Ó³É¹¦£©
½Ó´¥Java»òÕßJSP£¬ÄÑÃâ»áʹÓõ½Êý¾Ý¿â
SQL Server
2000/2005£¨ÎÒʹÓÃ2005±ê×¼°æ[9.0.3054]²âÊÔ£©£¬¾¹ý×Ô¼ºµÄËÑË÷ºÍÑо¿£¬Ê¹ÓÃJDBCÁ¬½ÓSQL
Server³É¹¦£¬ÌØ´ËÕûÀí·½·¨£¨Ê¹ÓÃEclipse 3.2£©ÈçÏ¡£
×¼±¸¹¤×÷
Ê×ÏÈ£¬²Ù×÷ϵͳ
Öа²×°ºÃSQL Server
2000/2005£¬È ......
Ê×ÏÈÄãÒªÓÐtomcat,»¹ÒªÓÐoracle jdbcµÄjarµµµÈ»·¾³.
µÚÒ»²½: дJSP
<%@ page contentType="text/html;charset=gb2312"%>
<%@ page import="java.sql.*"%>
<html>
<body>
<%Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
String url="jdbc:oracle:thin:@(des ......
ÔÚJSPÖеÄÈç¹ûʹÓà "Ïà¶Ô·¾¶" ÔòÓпÉÄÜ»á³öÏÖÎÊÌâ.
ÒòΪ ÍøÒ³ÖÐµÄ "Ïà¶Ô·¾¶" , ËûÊÇÏà¶ÔÓÚ "URLÇëÇóµÄµØÖ·" ȥѰÕÒ×ÊÔ´.
ÉÏÃæÕâ¾ä»°ÊÇʲôÒâ˼ÄØ ?
¾Ù¸öÀý×Ó:
¼ÙÈçÎÒÃÇÓÐÒ»¸öÏîÄ¿: MyApp
ÔÚ¸ÃÏîÄ¿ÏÂ, ÓÐÒ»¸öjspÎļþ¼Ð
¸ÃÎļþ¼ÐÏ°üÀ¨:
login.jsp // ......