usercheck.jsp

来自「用hibernate框架实现网上书店」· JSP 代码 · 共 63 行

JSP
63
字号
<%@ include file="common.jsp" %><%@page contentType="text/html"%><%@page pageEncoding="UTF-8"%><%@page session="true" %><%@page import="java.sql.*" %><html>    <head>        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">        <title></title>    </head>    <body>        <%!           String username=null,userpassword=null;        %>              <%          response.setContentType("text/html;charset=GB2312");         username=request.getParameter("uname");         userpassword=request.getParameter("upassword");         String rand = (String)session.getAttribute("rand");         String input = request.getParameter("rand");         if(username!=null&&userpassword!=null)             {              session.setAttribute("uname",username);              session.setAttribute("upassword",userpassword);         }         User user = bookDB.getUser(username);       %>      <%            if(username.equals("")|| userpassword.equals("")||username==null||userpassword==null)          {           out.println("<script>alert('用户名或密码不能为空!请重新登陆!');" +                    "location.href='login.jsp'</script>");          }         else             {              if(user.getUpassword().equals(userpassword))           {                  if (rand.equals(input))             {           %>            <jsp:forward page="index.jsp"/>      <%           session.setAttribute("uname",username);           }                  else             {                out.println("<script>alert('验证码输入不正确!请重新登陆!');" +                    "location.href='login.jsp'</script>");                                      }                                  }          else{            out.println("<script>alert('用户名或密码不正确!请重新登陆!');" +                    "location.href='login.jsp'</script>");            }              }      %>             </body></html>

⌨️ 快捷键说明

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