JSPµÄ¾Å¸öÒþº¬¶ÔÏó
Ò»¡¢page ¶ÔÏó
page¶ÔÏó´ú±íJSP±¾Éí£¬¸ü׼ȷµØ˵Ëü´ú±íJSP±»×ªÒëºóµÄServlet£¬Ëü¿ÉÒÔµ÷ÓÃServletÀàËù¶¨ÒåµÄ·½·¨¡£
¶þ¡¢config ¶ÔÏó
config ¶ÔÏóÀï´æ·Å×ÅһЩServlet ³õʼµÄÊý¾Ý½á¹¹¡£
config ¶ÔÏóʵÏÖÓÚjavax.servlet.ServletConfig ½Ó¿Ú£¬Ëü¹²ÓÐÏÂÁÐËÄÖÖ·½·¨£º
public String getInitParameter(name)
public java.util.Enumeration getInitParameterNames( )
public ServletContext getServletContext( )
public Sring getServletName( )
Èý¡¢request ¶ÔÏó
request ¶ÔÏó°üº¬ËùÓÐÇëÇóµÄÐÅÏ¢£¬È磺ÇëÇóµÄÀ´Ô´¡¢±êÍ·¡¢cookiesºÍÇëÇóÏà¹ØµÄ²ÎÊýÖµµÈµÈ¡£
request ¶ÔÏóʵÏÖjavax.servlet.http.HttpServletRequest½Ó¿ÚµÄ£¬ËùÌṩµÄ·½·¨¿ÉÒÔ½«Ëü·ÖΪËÄ´óÀࣺ
1.´¢´æºÍÈ¡µÃÊôÐÔ·½·¨£»
void setAttribute(String name, Object value) É趨nameÊôÐÔµÄֵΪvalue
Enumeration getAttributeNamesInScope(int scope) È¡µÃËùÓÐscope ·¶Î§µÄÊôÐÔ
Object getAttribute(String name) È¡µÃname ÊôÐÔµÄÖµ
void removeAttribute(String name) ÒƳýname ÊôÐÔµÄÖµ
2.È¡µÃÇëÇó²ÎÊýµÄ·½·¨
String getParameter(String name) &
Ïà¹ØÎĵµ£º
ActioÖд«µÝ²ÎÊý
request.setAttribute("userName",fbName);
request.setAttribute("passWord",pwd);
request.setAttribute("CDNUrl",CDNUrl);
-------------------------------------------------------------------
AC_FL_RunContent(
'codebase', 'http://download.macromed ......
<%@ page contentType="text/html; charset=gb2312" %>
<%@ page language="java" %>
<%@ page import="java.sql.*" %>
<%
//Çý¶¯³ÌÐòÃû
String driverName="org.gjt.mm.mysql.Driver";
//Êý¾Ý¿âÓû§Ãû
String userName="root";
//ÃÜÂë
S ......
¾³£¿´µ½Ðí¶àÈËÎÊÈçºÎÅäÖÃJDKºÍJSP£¬ÏÖÔÚÎÒ°Ñ·½·¨×ܽáÏ£¬Ï£Íû¶Ô´ó¼ÒÓÐËù°ïÖú¡£
µÚÒ»²½£ºÏÂÔØjdkºÍtomcat
µÚ¶þ²½£º°²×°ºÍÅäÖÃÄãµÄjdkºÍtomcat£ºÖ´ÐÐjdkºÍtomcatµÄ°²×°³ÌÐò£¬È»ºóÉèÖð´ÕÕ·¾¶½øÐа²×°¼´¿É¡£
1.°²×°j2sdkÒÔºó£¬ÐèÒªÅäÖÃһϻ·¾³±äÁ¿£¬ÔÚÎҵĵçÄÔ->ÊôÐÔ->¸ß¼¶->»·¾³±äÁ¿->ϵͳ±äÁ¿ÖÐÌí¼ÓÒÔÏ»· ......
JSP ÄÚÖöÔÏó ÊÕ²Ø
ÄÚÖöÔÏóÊDz»ÐèÒªÉùÃ÷£¬Ö±½Ó¿ÉÒÔÔÚJSPÖÐʹÓõĶÔÏó£¬JSPÓÐÒÔϼ¸ÖÖÄÚÖöÔÏó£º
1.request¶ÔÏó
request±íʾHttpServletRequest¶ÔÏó¡£Ëü°üº¬ÁËÓйØä¯ÀÀÆ÷ÇëÇóµÄÐÅÏ¢£¬²¢ÇÒÌṩÁ˼¸¸öÓÃÓÚ»ñÈ¡cookie, header, ºÍsessionÊý¾ÝµÄÓÐÓõķ½·¨¡£¿Í»§¶ËµÄÇëÇóÐÅÏ¢±»·â×°ÔÚrequest¶ÔÏóÖУ¬Í¨¹ýËü²ÅÄÜÁ˽⵽¿Í»§ ......
»·¾³ÅäÖúú󣬿ª·¢JSP³ÌÐò¾Í·Ç³£¼òµ¥ÁË¡£
File-->New-->Web Project
Ôڸô°¿ÚÖÐÊäÈëһЩ¹¤³Ì»ù±¾ÐÅÏ¢£¬±ÈÈ繤³ÌÃû£¬ÕâÀïÊäÈëΪ test1-01
ÕâÑùÒ»¸ö»ùÓÚJSPµÄÏîÄ¿¾Í½¨Á¢ÆðÀ´ÁË¡£
Package Explorer µÄÏÔʾ·½·¨£º
Windows-->Show View-->Package Explorer ÕâÑù¾ÍÄÜÏÔʾ³öÀ´À²£¡
Ï ......