萬盛學電腦網

 萬盛學電腦網 >> 網絡編程 >> jsp編程 >> Jsp九種對象詳解教程

Jsp九種對象詳解教程

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中的說明:其他類似

copyright © 萬盛學電腦網 all rights reserved