簡單介紹兩個JSP中隱含對象

來源:互聯網
上載者:User

標籤:request   cookies   object   介面   public   

一、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) 取得name 的參數值Enumeration

getParameterNames( ) 取得所有的參數名稱String[]

getParameterValues(String name) 取得所有name 的參數值

Map getParameterMap( )取得一個要求參數的Map

3.能夠取得請求HTTP 標題的方法

String getHeader(String name)取得name 的標題

Enumeration getHeaderNames()取得所有的標題名稱

Enumeration getHeaders(String name)取得所有name 的標題

int getIntHeader(String name)取得整數類型name 的標題

long getDateHeader(String name) 取得日期類型name 的標題

Cookie [] getCookies( ) 取得與請求有關的cookies

更多程式設計語言教程可登陸e良師益友網。


本文出自 “語過添情” 部落格,請務必保留此出處http://yuguotianqing.blog.51cto.com/9292883/1575095

簡單介紹兩個JSP中隱含對象

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.