Jsp的九种对象

网络整理 - 07-26

Jsp的九种对象我简述之:
page
application
request
response
session
config
out
pageContext
 
page
<%@page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" %>

response
<%
  response.setHeader("Pragma","No-cache"); 
  response.setHeader("Cache-Control","no-cache"); 
  response.setDateHeader("Expires", 0); 
%>

<%response.sendRedirect("login.jsp");%>

session
<%session.invalidate();%>

request/session
<%
 String errmsg = request.getParameter("errmsg");
 request.getSession(true);
 String chk = "false";
 session.putValue("Enter",chk);
%>

out
<%
 if(errmsg != null && errmsg.equals("error1"))
  out.print("你的用户号还没有开通!!");
 else if(errmsg != null && errmsg.equals("error2"))
  out.print("您输入管理员帐号或者密码不正确!!");
%> 

下面是request对象在Java doc中的说明:其他类似

Jsp的九种对象