當前位置:才華齋>IT認證>JAVA認證>

JSP基本語法與簡單表單的處理

JAVA認證 閲讀(1.84W)

JSP基本語法與簡單表單處理,setAttribute(String,Object)把變量的值保存在application中;

JSP基本語法與簡單表單的處理

jsp語法

jsp指令元素

(1)include:導入其它文件夾

(2)page:

language:用什麼語言,只能為JAVA

contentType:MIME類型

import:導入java包

(3)taglib:自定義標籤庫

jsp常用標準元素

(1)jsp:forward:跳轉到其它頁面

(2)jsp:include:插入其它文件 eg:

(3)jsp:plugin:插入applet小程序

(4)jsp:param:參數傳值

jsp內置對象

(1)request:常用方法

getParameter():提取表單元素的值

getRemoteAddr():獲取客户端IP值

(2)response:

sendRedirect():重定向到其它網頁

setcontentType();設置MIME值

(3)out:向網頁輸出

(4)application

setAttribute(String,Object)把變量的值保存在application中;

getAttribute(String)獲取保存在applicaion中的值

removeAttribute(String)刪除保存在application中的值

(5)session

setAttribute(String,Object)把變量的值保存在session中;

getAttribute(String)獲取保存在session中的值

removeAttribute(String)刪除保存在

jsp語法

jsp指令元素

(1)include:導入其它文件夾

(2)page:

language:用什麼語言,只能為JAVA

contentType:MIME類型

import:導入java包

(3)taglib:自定義標籤庫

jsp常用標準元素

(1)jsp:forward:跳轉到其它頁面

(2)jsp:include:插入其它文件 eg:

(3)jsp:plugin:插入applet小程序

(4)jsp:param:參數傳值

jsp內置對象

(1)request:常用方法

getParameter():提取表單元素的值

getRemoteAddr():獲取客户端IP值

(2)response:

sendRedirect():重定向到其它網頁

setcontentType();設置MIME值

(3)out:向網頁輸出

(4)application

setAttribute(String,Object)把變量的值保存在application中;

getAttribute(String)獲取保存在applicaion中的值

removeAttribute(String)刪除保存在application中的'值

(5)session

setAttribute(String,Object)把變量的值保存在session中;

getAttribute(String)獲取保存在session中的值

removeAttribute(String)刪除保存在session中的值

getID:獲取session編號