delogin.jsp

来自「新闻系统的具体的一块」· JSP 代码 · 共 29 行

JSP
29
字号
<%@ page language="java" import="java.util.*,dao.*,entity.*" pageEncoding="ISO-8859-1"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>    
    <title></title>    
	  </head>
  
  <body>
    <%request.setCharacterEncoding("GBK");
  	String userpassword=request.getParameter("password");
  	String username=request.getParameter("loginName");
    UserDao ud=new UserDao();
    boolean isexisteduser=ud.findUser(username,userpassword);
    if(isexisteduser==true){
    	User logineduser=new User(username,userpassword);
    	session.setAttribute("LOGINED_USER",logineduser);
    	List  loginedusers=new ArrayList();
    	if(application.getAttribute("LOGINED_USER")!=null){
    		loginedusers=(List)application.getAttribute("LOGINED_USER");
    	}
    	loginedusers.add(logineduser);
    	application.setAttribute("LOGINED_USER",loginedusers);
    	response.sendRedirect("index.jsp");
    }else{response.sendRedirect("login.jsp");}
    %> 
  </body>
</html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?