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
Ïà¹ØÎĵµ£º
oracle+jspÖÐblobÀàÐÍ´æ´¢´óÎı¾ÎÊÌâ½â¾ö·½·¨
oracle ´æ´¢´óÎı¾Ò»Ö±ÊÇÒ»¸ö¼¬ÊÖµÄÎÊÌâ¡£
Ò»¡¢´æÊý¾Ý¿â£º
<%@page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<%
//¶¨Òå±äÁ¿
java.sql.Connection conn; //Êý¾ ......
µÚÒ»ÖÖ JavaScriptÁ¬½ÓÊý¾Ý¿â£º
<mce:script language="JavaScript"><!--
// ´´½¨Êý¾Ý¿â¶ÔÏó
var objdbConn = new ActiveXObject("ADODB.Connection");
// DSN×Ö·û´®
var strdsn = "Driver={SQL Server};SERVER=192.168.0.210;UID=xhb;PWD=xhb;DATABASE=books";
// ´ò¿ªÊý¾ÝÔ´
objdbConn.Open(strdsn);
// ......
JSPµ÷ÓÃJavaBeanÔÚÍøÒ³É϶¯Ì¬Éú³ÉÖù״ͼ
ÎÒÃǾ³£ÒªÔÚÍøÒ³¿´µ½Ò»Ð©¶¯Ì¬¸üеÄͼƬ,×î³£¼ûµÄĪ¹ýÓÚ¹ÉƱµÄKÏßͼ£¬±¾ÎÄÊÔͼͨ¹ýÒ»¸ö¼òµ¥µÄʵÀý£¬Ïò´ó¼ÒչʾÈçºÎͨ¹ýJSP µ÷ÓÃJavaBeanÔÚÍøÒ³É϶¯Ì¬Éú³ÉÖù״ͼ¡£
¡¡¡¡±³¾°£º±¾ÈË×î½üÔÚΪijͳ¼Æ¾Ö¿ª·¢ÏîĿʱ,Éæ¼°µ½ÔÚÍøÒ³É϶¯Ì¬Éú³ÉͼƬµÄÎÊÌ⣬·ÑÁËÒ»ÌìµÄʱ¼ä,ÖÕÓڸ㶨,Ϊ°ïÖú´ó ......
JSPµÄÔËÐÐÄÚÄ»
¾³£ÓÐÅóÓÑÎÊÆð£¬JSPºÍServletÖ®¼äÓÐʲôÇø±ð£¬Á½ÕßÖ®¼äÓÖÓÐʲôÁªÏµ£¿ÆäʵServlet¼¼ÊõµÄ³öÏÖʱ¼äºÜÔ磬Êǵ±Ê±ÎªÁËJavaµÄ·þÎñÆ÷¶ËÓ¦Óöø¿ª·¢µÄ¡£´ó¼Ò¶¼ÖªµÀAppletÊÇÓ¦ÓÃС³ÌÐò£¬Servlet¾ÍÊÇ·þÎñÆ÷¶ËС³ÌÐòÁË¡£µ«ÔÚMicrosoft¹«Ë¾µÄASP¼¼Êõ³öÏÖºó£¬Ê¹Óà Servlet½øÐÐÏìÓ¦Êä³öʱһÐÐÐеÄÊä³öÓï¾ä¾ÍÏԵ÷dz£±¿×¾£ ......
JSP²ÊÉ«ÑéÖ¤Âë
Éú³ÉÓÐ4¸öËæ»úÊý×ÖºÍÔÓÂÒ±³¾°µÄͼƬ£¬Êý×ֺͱ³¾°ÑÕÉ«»á¸Ä±ä£¬·þÎñÆ÷¶ËˢУ¨ÓÃhistory.go(-1)Ò²»á±ä£©
ÔÐͲο¼ALIBABA http://china.alibaba.com/member/showimage
²úÉúÑéÖ¤ÂëͼƬµÄÎļþ-----image.jsp
<%@ page contentType="image/jpeg" import="java.awt.*,java.awt.image.*,java.util.*,java ......