jsp九大內建物件之pagecontext物件

2021-06-26 15:58:48 字數 1222 閱讀 2482

pagecontext物件

方 法 說 明

1 jspwriter getout() 返回當前客戶端響應被使用的jspwriter流(out)

2 httpsession getsession() 返回當前頁中的httpsession物件(session)

3 object getpage() 返回當前頁的object物件(page)

4 servletrequest getrequest() 返回當前頁的servletrequest物件(request)

5 servletresponse getresponse() 返回當前頁的servletresponse物件(response)

6 exception getexception() 返回當前頁的exception物件(exception)

7 servletconfig getservletconfig() 返回當前頁的servletconfig物件(config)

9 void setattribute(string name,object attribute) 設定屬性及屬性值

10 void setattribute(string name,object obj,int scope) 在指定範圍內設定屬性及屬性值

11 public object getattribute(string name) 取屬性的值

12 object getattribute(string name,int scope) 在指定範圍內取屬性的值

13 public object findattribute(string name) 尋找一屬性,返回起屬性值或null

14 void removeattribute(string name) 刪除某屬性

15 void removeattribute(string name,int scope) 在指定範圍刪除某屬性

16 int getattributescope(string name) 返回某屬性的作用範圍

17 enumeration getattributenamesinscope(int scope) 返回指定範圍內可用的屬性名列舉

18 void release() 釋放pagecontext所占用的資源

19 void forward(string relativeurlpath) 使當前頁面重導到另一頁面

20 void include(string relativeurlpath) 在當前位置包含另一檔案

JSP九大內建物件

該物件代表 web 應用本身,整個 web 應用共享同乙個 物件,該物件主要用於在多個 jsp 頁面或 servlet 之間共享變數。通過 setattribute 方法將乙個值放入某個屬性,該屬性的值對整個 web 應用有效,因此 web 應用的每個 jsp 頁面或servlet 都可以訪問該屬性...

jsp九大內建物件

1.out 向客戶端輸出資料,位元組流。out.print 2.request 接受客戶端的http請求 getparamenter string name name表示表單的引數名 getparamentervalues string name 使用得到的是string getattribute ...

JSP九大內建物件

常用 out 向客戶端輸出內容 request 封裝客戶端的請求資訊 response 包含了響應客戶請求的有關資訊,具有頁面作用域 頁面訪問完後即銷毀 session 表示客戶端與伺服器端一次會話 其他 page 當前jsp頁面 pagecontext 本頁面內的所有操作 exception 異常...