jsp九大内置对象
1.out //向客户端输出数据 字节流
2.request 接受客户端的http请求------servlet中的HttpServletRequest
getParameter(String name);//name表示表单的参数名
getParameterValues(String name);//使用得到是String[];
setAttribute(String name,Object obj)//设置名字为name的obj,值为obj;
getAttribute(String name);//返回由name指定的属性值,如果不存在就返回NULL;
getCookie();
3.response //封装jsp产生的回应 -----------servlet中的HttpServletResponse
addCookie(Cookie cookie);
sendRedirect(“./welcome.jsp”)
4.session //用于保存用户的信息,跟踪用户的行为----servletHttpSession
setAttribute(String name,Object obj);
getAttribute(String name);
5.application //多个用户共享该对象,可以做计数器-----servlet的ServletContext
6.pageContext 代表jsp页面的上下文,也是一个域对象,可以setAttribute(),作用范围只是本页面
7exception 代表运行时的一个异常 getMessage()
8.page 代表 jsp这个实例本身(使用比较少)
9.config 代表jsp对应的servlet的配置 可以得到web.xml中的参数—ServletConfig;
九大内置对象的作用范围:
1.pageContext(域对象,存放的数据只能在当前页面使用)
2.request (域对象,存放的数据在一次request请求有效)
3.session(域对象,存放的数据在一次会话有效)
4.application(域对象,存放的数据在整个WEB应用运行期间有效)
浙公网安备 33010602011771号