国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > JSP > 正文

JSP內置對!象之request和response

2019-11-02 15:02:42
字體:
來源:轉載
供稿:網友

  JSP內置對象之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) 返回一虛擬路徑的真實路徑

  < %@ page contentType="text/html;charset=gb2312"%>< %request.setCharacterEncoding("gb2312");%> < html> < head> < title>request對象_例1< /title> < /head> < body bgcolor="#FFFFF0"> < form action="" method="post"> < input type="text" name="qwe"> < input type="submit" value="提交"> < /form> 請求方式:< %=request.getMethod()%>< br> 請求的資源:< %=request.getRequestURI()%>< br> 請求用的協議:< %=request.getProtocol()%>< br> 請求的文件名:< %=request.getServletPath()%>< br> 請求的服務器的IP:< %=request.getServerName()%>< br> 請求服務器的端口:< %=request.getServerPort()%>< br> 客戶端IP地址:< %=request.getRemoteAddr()%>< br> 客戶端主機名:< %=request.getRemoteHost()%>< br> 表單提交來的值:< %=request.getParameter("qwe")%>< br> < /body> < /html> < %@ page contentType="text/html;charset=gb2312"%> < %request.setCharacterEncoding("gb2312");%> < %@ page import="java.util.Enumeration"%> < html> < head> < title>request對象_例2< /title> < /head> < body bgcolor="#FFFFF0"> < form action="" method="post"> 用戶名:< input type="text" name="username"> 密 碼:< input type="text" name="userpass"> < input type="submit" value="進入" > < /form> < % String str=""; if(request.getParameter("username")!=null && request.getParameter("userpass")!=null){ Enumeration enumt = request.getParameterNames(); while(enumt.hasMoreElements()){ str=enumt.nextElement().toString(); out.println(str ":" request.getParameter(str) "< br>"); } } %> < /body> < /html> < %@ page contentType="text/html;charset=gb2312"%> < %request.setCharacterEncoding("gb2312");%> < html> < head> < title>request對象_例3< /title> < /head> < body bgcolor="#FFFFF0"> <

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 孝昌县| 临邑县| 喜德县| 卢湾区| 贵阳市| 博白县| 文化| 阳城县| 霍山县| 花莲市| 马边| 梅河口市| 柘城县| 嘉祥县| 桐庐县| 汉沽区| 基隆市| 巴塘县| 五指山市| 清徐县| 冀州市| 洛川县| 伊金霍洛旗| 淳安县| 福安市| 海丰县| 黄梅县| 大洼县| 新民市| 彩票| 吉隆县| 方城县| 夏津县| 汽车| 海盐县| 古丈县| 巴楚县| 格尔木市| 吉木萨尔县| 思南县| 墨脱县|