Jsp中9大内建对象

来源:互联网 发布:网络人旗舰版注册 编辑:程序博客网 时间:2024/06/10 20:36

频繁使用的:

            request:(HttpServletRequest):getAttribute("key"),setAttribute("key",value);getParameter("name")

            session:(HttpSession):setAttribute("key",value),getAttribute("key"),removeAttribute("key");

            pageContext:(PageContext):getRequest(),getResponse(),getSession(),getServletContext();

经常使用的:

            response:(HttpServletResponse):addCookies(),setContentType(),sendRedirect("url");


            application:(ServletContext):setAttribute("key",value),getAttribute("key"),removeAttribute("key")

            out:(JspWriter):print(),write(),writeln(),close(),flush();

其他:     

            page:(Obiect):

            config:(ServletContext):页面配置对象

            exception:(Throwable):异常处理对象(仅当jsp页面isErrorPage="true"时存在);


两种跳转方式:

       请求转发跳转:request.getRequestDispatcher(url).forword(request,response);

       重定向跳转:response.sendRedirect(url);
原创粉丝点击