Jsp内置对象

注:Jsp中println和print一样,均不换行

作用域范围
(1)out
(2)request/response
get和post区别
< name=”” action=”“method=”“>//form调用
get,明文通过url传递,最多2kb
post,封装在html header中
request的方法:
String getParameter(String name)返回name指定参数的参数值
String[]getParameterValues(String name) 返回所有含有name的数组
void setAttribute(String,Object)
Object getAttribute(String name)
String getContentType()
int getContentLength()
String getProtocol()
String getServerName()
String getServerPort()
response
getWriter()//返回PrintWriter对象,执行在out之前
sendRedirect(“*.jsp”)//请求重定向
注:请求重定向与请求转发的区别(2次/1次)
(3)session
Jsp内置对象_第1张图片
session是HttpSession类的实例
Jsp内置对象_第2张图片
(4)application
Jsp内置对象_第3张图片
(5)page
Jsp内置对象_第4张图片
(6)pageContext

(7)config
Jsp内置对象_第5张图片
(8)exception

需要在头文件中添加errorPage=”*.jsp”,表示出现异常的时候,交给哪个页面去处理

你可能感兴趣的:(jsp)