標籤:tin 判斷 移動 time() cat time 其他 tostring 語言
內建對象包括
request response pageContext session application out config page exception
1.out
(1)clear()清除緩衝區
(2)flush()重新整理緩衝區
(3)newLine() 建立新的一行
(4)print(各種資料類型)顯示資料內容
(5)pringln(各種資料類型)換行顯示資料內容
2.request 向伺服器發送請求
(1)getLocale() 擷取本地的語言
(2)getMethod()擷取用戶端的參數方法 post get
(3)getParameter(String name)取得傳入的參數
(4)getParameterNames()取得傳入參數的名字集合
(5)getParameterMap()取得傳入參數的Map集合 參數名和值
(6)getRemoteAddr()取得用戶端的網路地址
(7)getServerName()取得伺服器的名字
(8)getServletPath()擷取servlet的路徑
(9)setCharacterEncoding(String s)設定傳入參數的字元集
3.response
(1)addCookie(Cookie cookie)
(2)sendRedirect()重新導向
(3)setBufferSize()設定緩衝大小
(4)setContentType()設定用戶端的編碼機制
(5)setLocale()設定用戶端的語言
(6)getWrite()取得內容輸出器
4.session 會話
(1)getAttribute()根據名字取得session的參數值
(2)getAttributeName() 擷取session的參數名
(3)getCreationTime()取得session的建立時間 用戶端的訪問伺服器的時間
(4)getId()擷取用戶端的id
(5)getLastAccessTime() 擷取客戶最後一次訪問伺服器的時間
(6)getMaxInactiveInterval() 用戶端停止訪問後在伺服器的儲存時間
(7)isNew() 判斷用戶端是否是第一次訪問伺服器
(8)removeAttribute()刪除session的參數
(9)setAttribute()設定session的參數
(10)setMaxInactiveInterval() 設定用戶端停止訪問後在伺服器的儲存時間
5.application 應用
(1)getAttribute()根據名字取得application的參數值
(2)getAttributeName() 擷取application的參數名
(3)setAttribute()設定application的參數
(4)getMajorVersion()取得伺服器支援servlet的版本號碼
(5)removeAttribute()刪除application的參數
6.config 配置
(1)getInitParameter()根據名字擷取初始化參數值
(2)getInitParameterNames()取得初始化參數名字
7.pageContext 內容物件
(1)forward()將客戶的請求移動到另一個jsp檔案
(2)getAttribute(String name,int scope)根據參數的名字和範圍取得參數值
(3)getAttributeNamesInScope(int scope)取得某個範圍參數名
(4)removeAttribute(String name,int scope)根據參數的名字和範圍刪除參數
(5)setAttribute(String name,Object o,int scope)根據參數的名字和作用範圍建立參數
(6)getException()取得exception對象
(7)getOut()取得out對象
(8)getPage()取得page對象
(9)getRequest()取得request對象
(10)getResponse()取得response對象
(11)getSession()取得session對象
(12)include()在jsp檔案中包含其他檔案
(13)getServletContext()取得application對象
8.exception 異常
(1)getLocalizedMessage()取得異常資訊
(2)getMessage()取得詳細的異常資訊
(3)printStackTrace() 在伺服器端顯示異常資訊
(4)toString() 顯示異常類和資訊
9.page
該對象的實質就是java.lang.Object,在JSP檔案內沒有實質的應用
JSP九大內建對象及其方法