⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 login.jsp~33~

📁 这是一个图书馆管理系统的jsp代码
💻 JSP~33~
字号:
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
//-->
</script>
<style type="text/css">
<!--
.style2 {font-size: 24px}
-->
</style></head>

<body>
<form name="form1" method="post" action="">
  <table width="517" border="0" align="center" cellpadding="0" cellspacing="1">
    <tr>
      <td width="52" height="42">&nbsp;</td>
      <td height="42">&nbsp;</td>
      <td width="52" height="42">&nbsp;</td>
    </tr>
    <tr>
      <td height="101">&nbsp;</td>
      <td height="101"><img src="F:\example\图书馆\login\library1.gif" alt=""></td>
      <td height="101">&nbsp;</td>
    </tr>
    <tr>
      <td width="52" height="300">&nbsp;</td>
      <td height="300"><table width="60%" border="0" align="center" cellpadding="10" cellspacing="1">
        <tr>
          <td width="32%" align="right"><span class="style2">ID</span></td>
          <td><input name="user" type="text" id="user" size="15" maxlength="12"></td>
        </tr>
        <tr>
          <td width="32%" align="right"><span class="style2">code</span></td>
          <td><input name="code" type="password" id="code" size="15" maxlength="12"></td>
        </tr>
        <tr align="center" valign="top">
          <td colspan="2"><select name="rights" size="1" id="rights">
            <option selected>User</option>
            <option>Administrator</option>
          </select></td>
        </tr>
        <tr align="center" valign="top">
          <td colspan="2"><table width="80%"  border="0" cellpadding="0" cellspacing="1">
            <tr align="center">
              <td width="20%"><input type="submit" name="Submit" value="Enter"></td>
              <td width="20%"><input name="reset" type="reset" id="reset" value="Reset"></td>
            </tr>
          </table></td>
          </tr>
      </table></td>
      <td width="52" height="300">&nbsp;</td>
    </tr>
    <tr>
      <td width="52">&nbsp;</td>
      <td><img src="F:\example\图书馆\login/library2.png" width="508" height="40" alt=""></td>
      <td width="52">&nbsp;</td>
    </tr>
  </table>
</form>
<jsp:useBean id="Library" scope="session" class="login.Library">
</jsp:useBean>
<%

String validrights1 = "User";
String validrights2 = "Administrator";
try{
  if(request.getParameter("Submit")!=null){
  Connection conn=Library.getConn();
  Statement stmt=conn.createStatement();
  String id = request.getParameter("user");
String code = request.getParameter("code");
String rights = request.getParameter("rights");
  if(validrights2.equals(rights)){
    String checkUser="select * from administrator where id ='" + id + "'and code ='" + code + "'";
    ResultSet rs = stmt.executeQuery(checkUser);
    if(rs.next()){
    response.sendRedirect("administratorlogin.jsp");

}else{
    response.sendRedirect("fail.jsp");
  }
  }else {
  String checkUser="select * from user where id ='" + id + "'and code ='" + code + "'";
    ResultSet rs = stmt.executeQuery(checkUser);
    if(rs.next()){
      Library.setid(id);
   //   String s=Library.getid();
    //  out.println("<p>"+s+"</p>");
      response.sendRedirect("userlogin.jsp");

  }else{
    response.sendRedirect("fail.jsp");
  }

  }
  }
}catch (Exception ex) {
ex.printStackTrace();}

%>

</body>
</html>

⌨️ 快捷键说明

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