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

jsp request sessionµÈ¶ÔÏó Ïê½â


jsp request session
µÈ¶ÔÏó

Ïê½â
 
תÕß×¢£º´ËÎÄ×ܽá½ÏΪÏêϸ£¬ÖµµÃ²Î¿¼¡£µ«²¿·ÖÄÚÈݾ­¹ýÕûÀí£¬ÒÔÏÂÊÇÕýÎÄ¡£
 
1.request
¶ÔÏó
 
ÕâÁ½¸ö¶ÔÏóÊÇASPËùÌṩµÄÄÚÖöÔÏóÖÐ×î³£ÓõÄÁ½¸ö¡£ÔÚä¯ÀÀÆ÷£¨»òÆäËûÓû§´úÀí£©ºÍWeb·þÎñÆ÷Ö®¼ä£¬ÇëÇóÓëÏìÓ¦Öз¢ÉúµÄÐÅÏ¢½»Á÷¿ÉÒÔͨ¹ýASPÖеÄÁ½¸öÄÚÖöÔÏóÀ´½øÐзÃÎʺ͹ÜÀí£¬ÕâÁ½¸ö¶ÔÏó³ÆΪRequestºÍResponse¶ÔÏó¡£
    
¿Í»§¶ËµÄÇëÇóÐÅÏ¢±»·â×°ÔÚ
request
¶ÔÏóÖУ¬Í¨¹ýËü²ÅÄÜÁ˽⵽¿Í»§µÄÐèÇó£¬È»ºó×ö³öÏìÓ¦¡£ËüÊÇ
HttpServletRequest
ÀàµÄʵÀý¡£
 
(1)Attribute
ÉèÖÃ
 
£¨
get
»ò
set
£©
object getAttribute(String name)
·µ»Ø
name
Ö¸¶¨µÄÊôÐÔÖµ£¬Èç¹ûÖ¸¶¨µÄÊôÐÔÖµ²»´æÔÚ£¬Ôò»á·µ»Ø
null
Öµ£®
Enumeration getAttributeNames()
·µ»Ø
request
¶ÔÏóµÄËùÓÐÊôÐÔµÄÃû×Ö£¬Æä½á¹ûÊÇÒ»¸öÀà¾Ù£¨
Enumeration
£©ÀàµÄʵÀý£®
void setAttribute( String name ,
java.lang.Object objt )
ÉèÖÃÃû×ÖΪ
name
µÄ
request
²ÎÊýµÄÖµ£¬¸ÃÖµÊÇÓÉ
java.lang.Object
ÀàÐ͵Ä
objt
Ö¸¶¨
 
(2) Parameter
String getParameter( String name )
»ñµÃ¿Í»§¶Ë´«Ë͸ø·þÎñÆ÷µÄ²ÎÊýÖµ£¬¸Ã²ÎÊýÊÇÓÉ
name
Ö¸¶¨µÄ£®
Enumeration getParameterNames()
·µ»Ø¿Í»§¶Ë´«¸ø·þÎñÆ÷ÕªµÄËùÓвÎÊýµÄÃû×Ö£¬Æä½á¹ûÒ²ÊÇÒ»¸öÀà¾ÙÀàµÄʵÀý£®
String [] getParameterValues( String name )
»ñµÃÖ¸¶¨²ÎÊýµÄËùÓÐÖµ£¬²ÎÊýÓÉ
name
Ö¸¶¨£®
 
(3) Method
getMethod()
»ñµÃ¿Í»§¶ËÏò·þÎñÆ÷¶Ë´«ËÍÊý¾ÝµÄ·½·¨£¬Èç
get,post
µÈ£®
 
(4)
¿Í»§¶ËºÍ·þÎñÆ÷Ö®¼äµÄ
Protocol
×å
String getProtocol()
·µ»ØÇëÇóÓõÄЭÒéÀàÐͼ°°æ±¾ºÅ
String getServerName()
·µ»Ø½ÓÊÜÇëÇóµÄ·þÎñÆ÷Ö÷»úÃû
int getServerPort()
·µ»Ø·þÎñÆ÷½ÓÊÜ´ËÇëÇóËùÓõĶ˿ںÅ
String getRemoteAddr()
·µ»Ø·¢ËÍ´ËÇëÇóµÄ¿Í»§¶Ë
IP
µØÖ·
String getRemoteHost()
·µ»Ø·¢ËÍ´ËÇëÇóµÄ¿Í»§¶ËÖ÷»úÃû
getRequestURI()
»ñÈ¡·¢³öÇëÇó×Ö·û´®µÄ¿Í»§¶ËµÄµØÖ·£®
 
(5) Header
getHeader( String name )
·µ»ØÖ¸¶¨Ãû×ÖµÄ
request Header
µÄËùÓÐÖµ£¬Æä½á¹ûÒ²ÊÇÒ»¸öÀà¾ÙÀàµÄʵÀý£®
getHeaderNames()
·µ»ØËùÓÐ
request Header
µÄÃû×Ö£¬Æä½á¹ûÒ²ÊÇÒ»¸öÀà¾ÙÀàµÄʵÀý£®
 
(6)
ÆäËû
String getCharacterEncoding()
·µ»Ø×Ö·û±àÂ뷽ʽ
int getContentLeng


Ïà¹ØÎĵµ£º

jspµ÷ÓÃjavabeanʵÀý

goodsbean.java
package sale;
public class goodsbean{
    String Product;
    double Price;
    public goodsbean (){
    this.Product = "box";
    this.Price = 5.0;
    }
public void setProduct (String ......

oracle+jspÖÐblobÀàÐÍ´æ´¢´óÎı¾ÎÊÌâ½â¾ö·½·¨


 
 
 
 
 
oracle+jspÖÐblobÀàÐÍ´æ´¢´óÎı¾ÎÊÌâ½â¾ö·½·¨
oracle ´æ´¢´óÎı¾Ò»Ö±ÊÇÒ»¸ö¼¬ÊÖµÄÎÊÌâ¡£
Ò»¡¢´æÊý¾Ý¿â£º
<%@page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<%
//¶¨Òå±äÁ¿
java.sql.Connection conn; //Êý¾ ......

Eclipse JSP ±êÇ©×Ô¶¯Ìáʾ


ÎÒÃÇÔÚдһ¸öjspÒ³Ã棬ҪʹÓÃstruts2±êÇ©£¬ÎÒÃÇÒªÊ×ÏÈÒªÔÚjspÒ³ÃæÍ·²¿·Å£º<%@ taglib prefix="s" uri="/struts-tags" %>£¬µ±È»Òª·Åstruts2µÄjar°üÁË¡£ÎÒÃÇ¿ÉÒÔË¢ÐÂһϴËÒ³Ã棬±ÈÈç°ÑÕâ¸öÒ³Ãæ±£´æºóÔÙ´ò¿ª£¬Ä¿µÄÊÇÔÚдstruts2±êǩʱ£¬ÓÐstruts2±êÇ©×Ô¶¯Ìáʾ¹¦ÄÜ¡£
......

ÒýÓà JDK 6u12+Tomcat6.0+JSP¾­µäÅäÖÃ(Íêȫ׼ȷÎÞÎó£©

µÚÒ»²½£ºJDKÓëTomcatµÈµÄÏÂÔØÓëÅäÖÃ
    ×îеÄJDKΪ6.0£¨jdk-6u12-windows-i586-p.exe£©£¬tomcatΪ6.0(apache-tomcat-6.0.18.exe)
¿ª·¢»·¾³£º
JDK: jdk-6u12-windows-i586-p.exe
ÏÂÔصØÖ·:http://java.sun.com/javase/downloads/index.jsp
Tomcat:apache-tomcat-6.0.18.exe
ÏÂÔصØÖ·:http://tomcat.a ......

Íê³ÉÄãµÄ×Ô¶¨ÒåJSP Tag±êÇ©£­Basic Coustom Tag

˵Ã÷£º»ùÓÚEclipse 3.2 + Tomcat 4.0±àÒëÍê³É
1.Íê³ÉÄã×Ô¼ºµÄTag Class£¬javax.servlet.jspÖÐÌṩһ¸öTag½Ó¿ÚÀà
TagSupport ºÍ BodyTagSupportÁ½¸öÀ࣬Äã×Ô¼ºµÄTag Class±ØÐë
extendsÆäÖÐÒ»¸ö¡£±¾ÀýÖÐHrefTag Class extends TagSupportÀ࣬²¢
Íê³ÉÁËdoStratTag·½·¨µÄÖØд£¬Ö÷Òª´úÂëÈçÏ£º
public int doStartTag(){
J ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ