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

jsp 9¸öÄÚÖöÔÏóÏê½â jsp »ù´¡ÖªÊ¶


1.request¶ÔÏó
¿Í»§¶ËµÄÇëÇóÐÅÏ¢±»·â×°ÔÚrequest¶ÔÏóÖУ¬Í¨¹ýËü²ÅÄÜÁ˽⵽¿Í»§µÄÐèÇó£¬È»ºó×ö³öÏìÓ¦¡£ËüÊÇHttpServletRequestÀàµÄʵÀý¡£
ÐòºÅ ·½ ·¨ ˵ Ã÷
1 object getAttribute(String name) ·µ»ØÖ¸¶¨ÊôÐÔµÄÊôÐÔÖµ
2 Enumeration getAttributeNames() ·µ»ØËùÓпÉÓÃÊôÐÔÃûµÄö¾Ù
3 String getCharacterEncoding() ·µ»Ø×Ö·û±àÂ뷽ʽ
4 int getContentLength() ·µ»ØÇëÇóÌåµÄ³¤¶È£¨ÒÔ×Ö½ÚÊý£©
5 String getContentType() µÃµ½ÇëÇóÌåµÄMIMEÀàÐÍ
6 ServletInputStream getInputStream() µÃµ½ÇëÇóÌåÖÐÒ»ÐеĶþ½øÖÆÁ÷
7 String getParameter(String name) ·µ»ØnameÖ¸¶¨²ÎÊýµÄ²ÎÊýÖµ
8 Enumeration getParameterNames() ·µ»Ø¿ÉÓòÎÊýÃûµÄö¾Ù
9 String[] getParameterValues(String name) ·µ»Ø°üº¬²ÎÊýnameµÄËùÓÐÖµµÄÊý×é
10 String getProtocol() ·µ»ØÇëÇóÓõÄЭÒéÀàÐͼ°°æ±¾ºÅ
11 String getScheme() ·µ»ØÇëÇóÓõļƻ®Ãû,Èç:http.https¼°ftpµÈ
12 String getServerName() ·µ»Ø½ÓÊÜÇëÇóµÄ·þÎñÆ÷Ö÷»úÃû
13 int getServerPort() ·µ»Ø·þÎñÆ÷½ÓÊÜ´ËÇëÇóËùÓõĶ˿ںÅ
14 BufferedReader getReader() ·µ»Ø½âÂë¹ýÁ˵ÄÇëÇóÌå
15 String getRemoteAddr() ·µ»Ø·¢ËÍ´ËÇëÇóµÄ¿Í»§¶ËIPµØÖ·
16 String getRemoteHost() ·µ»Ø·¢ËÍ´ËÇëÇóµÄ¿Í»§¶ËÖ÷»úÃû
17 void setAttribute(String key,Object obj) ÉèÖÃÊôÐÔµÄÊôÐÔÖµ
18 String getRealPath(String path) ·µ»ØÒ»ÐéÄâ·¾¶µÄÕæʵ·¾¶
2.response¶ÔÏó
response¶ÔÏó°üº¬ÁËÏìÓ¦¿Í»§ÇëÇóµÄÓйØÐÅÏ¢£¬µ«ÔÚJSPÖкÜÉÙÖ±½ÓÓõ½Ëü¡£ËüÊÇHttpServletResponseÀàµÄʵÀý¡£
ÐòºÅ ·½ ·¨ ˵ Ã÷
1 String getCharacterEncoding() ·µ»ØÏìÓ¦ÓõÄÊǺÎÖÖ×Ö·û±àÂë
2 ServletOutputStream getOutputStream() ·µ»ØÏìÓ¦µÄÒ»¸ö¶þ½øÖÆÊä³öÁ÷
3 PrintWriter getWriter() ·µ»Ø¿ÉÒÔÏò¿Í»§¶ËÊä³ö×Ö·ûµÄÒ»¸ö¶ÔÏó
4 void setContentLength(int len) ÉèÖÃÏìӦͷ³¤¶È
5 void setContentType(String type) ÉèÖÃÏìÓ¦µÄMIMEÀàÐÍ
6 sendRedirect(java.lang.String location) ÖØж¨Ïò¿Í»§¶ËµÄÇëÇó
¡¡
3.session¶ÔÏó
session¶ÔÏóÖ¸µÄÊÇ¿Í»§¶ËÓë·þÎñÆ÷µÄÒ»´Î»á»°£¬´Ó¿Í»§Á¬µ½·þÎñÆ÷µÄÒ»¸öWebApplication¿ªÊ¼£¬Ö±µ½¿Í»§¶ËÓë·þÎñÆ÷¶Ï¿ªÁ¬½ÓΪֹ¡£ËüÊÇHttpSessionÀàµÄʵÀý.
ÐòºÅ ·½ ·¨ ˵ Ã÷
1 long getCreationTime() ·µ»ØSESSION´´½¨Ê±¼ä
2 public String getId() ·µ»ØSESSION´´½¨Ê±JSPÒýÇæΪËü


Ïà¹ØÎĵµ£º

jspÒ³ÃæÌøתÎÊÌâ

 ÕâÊÇÒ»¸öÓû§×¢²áµÄÒ³Ã棬²¿·Ö´úÂ루ûÓдíÎó£©ÒÑÂÔ£¬¿ÉÊDz»ÄÜʵÏÖformµÄactionÌøת
checkform()ÀïÃ÷Ã÷ÓÐdocument.form.submit()£¬¾ÍÊDz»ÄÜÌøת£¬
 
ÄÜ°ïÎÒ¿´ÏÂÎÊÌâ³öÔÚÄÄÂð£¿
ÕâÊÇÕÕ×ÅÊéÉϵÄÀý×ÓдµÄ£¬×¢²áºÍÖØÖö¯¶¼×÷ÊÇͨ¹ýͼƬÀ´´¦ÀíµÄ¡£
Çë²»Áߴͽ̣¬ÔÚϲ»Ê¤¸Ð¼¤¡£¡£¡£
<%@ page contentType="te ......

jspÖÐͨ¹ýURLµØÖ·»ñÈ¡¸ÃµØÖ·Ò³ÃæÖеľ²Ì¬Ò³Ãæ


try {
            URL url = new URL("http://www.163.com");
            InputStream is = url.openStream();
            byte[] buffer = new byte[1024];
           ......

JSPÎļþ

<%@ page language="java" import="kg.TestBean2;" %>
<%@ page contentType="text/html;charset=gb2312" %>
<html>
<head>
<title>HelloBean</title>
</head>
<body>
<%--
<%
kg.TestBean2 testbean=(kg.TestBean2)session.setAttribute("testbean");
if ......

JSP¼Ü¹¹¡¢JSP¿ª·¢¹¤¾ßÓÅȱµã±È½Ï

   Ëæ׿¼ÊõµÄÈÕÐÂÔÂÒì £¬JSPµÄм¼ÊõÒ²²ã³ö²»ÇΪÁË·½Ãæ´ó¼ÒµÄѧϰÓ빤×÷£¬ÏÂÃ潫¼òµ¥µÄ½éÉÜÒ»ÏÂJSP¼Ü¹¹¡¢JSP¿ª·¢¹¤¾ß¡¢Web·þÎñÆ÷¼°Æäîñȱµã¡£
    JSP¼Ü¹¹£º
    struts£º  Struts¸úTomcat¡¢TurbineµÈÖî¶àApacheÏîÄ¿Ò»Ñù£¬ÊÇ¿ªÔ´Èí¼þ£¬ÕâÊÇËüµÄÒ»´óÓŵ㣬ʹ¿ª·¢ÕßÄܸüÉ ......

JSPʵÏÖÎļþÉÏ´«

ʹÓÃRandomAccessFileÀàÌṩµÄ¹¦ÄÜÀ´ÊµÏÖÎļþÉÏ´«¡£µ±ÎÒÃÇÏë¶ÔÒ»¸öÎļþ½øÐжÁд²Ù×÷ʱ£¬¿ÉÒÔ´´½¨Ò»¸öÖ¸Ïò¸ÃÎļþµÄRandomAccessFileÁ÷¼´¿É£¬ÕâÑù¼È¿ÉÒÔ´ÓÕâ¸öÁ÷ÖжÁÈ¡Õâ¸öÎļþµÄÊý¾Ý£¬Ò²Í¨¹ýÕâ¸öÁ÷дÈëÊý¾Ý¸øÕâ¸öÎļþ¡£
ÀûÓÃJavaBean¸ºÔð½«Óû§Ñ¡ÔñµÄÎļþÉÏ´«µ½·þÎñÆ÷¡£bean¿ÉÒÔÈÃÄÚÖöÔÏórequestµ÷Ó÷½·¨getInputStream£ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ