热门文章 | 热门软件| 热门源码 | 热门电影 | 知识库 | 联系我们
软件 源码 教程 影视 健康 招聘
  HTML | JavaScript | ASP | PHP | JSP | NET | VB | VC | VF | Windows | Linux | Mysql | Mssql | Oracle | Struts 
当前位置: 创世纪计算机资源网 -> 文章频道 ->jsp 
站内搜索:
jsp之通过session实现登录验证
作者:小红帽 来源:创世纪计算机资源网 整理日期:2007-3-17

下面的例子通过简单的session实现验证:
<%@page contentType="text/html;charset=gb2312" %>
<%@page import="java.util.*" %>
<html>
 <head>
   <title>对请求的访问权限判断
   </title> 
 </head>
<body>
<center>
<%
String id;
String user_name;
id=(String)session.getValue("user_id");
user_name=(String)session.getValue("user_name");
%>

<%if ((id==null)||(user_name==null))
    out.print("<font size=4 color=red>抱歉,非法用户不能进入系统!</font>");
%>
<br>
<%if ((id!=null)&&(user_name!=null))
    out.print("欢迎使用本系统功能!");
%>

</center>
</body>
</html>

 

 

相关文章