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

📄 login_jsp.java

📁 这是一个图书馆系统
💻 JAVA
字号:
package org.apache.jsp;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import java.sql.*;

public final class login_jsp extends org.apache.jasper.runtime.HttpJspBase
    implements org.apache.jasper.runtime.JspSourceDependent {

  private static java.util.Vector _jspx_dependants;

  public java.util.List getDependants() {
    return _jspx_dependants;
  }

  public void _jspService(HttpServletRequest request, HttpServletResponse response)
        throws java.io.IOException, ServletException {

    JspFactory _jspxFactory = null;
    PageContext pageContext = null;
    HttpSession session = null;
    ServletContext application = null;
    ServletConfig config = null;
    JspWriter out = null;
    Object page = this;
    JspWriter _jspx_out = null;
    PageContext _jspx_page_context = null;


    try {
      _jspxFactory = JspFactory.getDefaultFactory();
      response.setContentType("text/html; charset=gb2312");
      pageContext = _jspxFactory.getPageContext(this, request, response,
      			"", true, 8192, true);
      _jspx_page_context = pageContext;
      application = pageContext.getServletContext();
      config = pageContext.getServletConfig();
      session = pageContext.getSession();
      out = pageContext.getOut();
      _jspx_out = out;

      out.write("\r\n");
      out.write("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"\r\n");
      out.write("\"http://www.w3.org/TR/html4/loose.dtd\">\r\n");
      out.write("<html>\r\n");
      out.write("<head>\r\n");
      out.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=gb2312\">\r\n");
      out.write("<title>图书馆</title>\r\n");
      out.write("<script language=\"JavaScript\" type=\"text/JavaScript\">\r\n");
      out.write("<!--\r\n");
      out.write("function MM_reloadPage(init) {  //reloads the window if Nav4 resized\r\n");
      out.write("  if (init==true) with (navigator) {if ((appName==\"Netscape\")&&(parseInt(appVersion)==4)) {\r\n");
      out.write("    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}\r\n");
      out.write("  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();\r\n");
      out.write("}\r\n");
      out.write("MM_reloadPage(true);\r\n");
      out.write("//-->\r\n");
      out.write("</script>\r\n");
      out.write("<style type=\"text/css\">\r\n");
      out.write("<!--\r\n");
      out.write(".style2 {font-size: 24px}\r\n");
      out.write("-->\r\n");
      out.write("</style></head>\r\n");
      out.write("\r\n");
      out.write("<body>\r\n");
      out.write("<form name=\"form1\" method=\"post\" action=\"\">\r\n");
      out.write("  <table width=\"517\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"1\">\r\n");
      out.write("    <tr>\r\n");
      out.write("      <td width=\"52\" height=\"42\">&nbsp;</td>\r\n");
      out.write("      <td height=\"42\">&nbsp;</td>\r\n");
      out.write("      <td width=\"52\" height=\"42\">&nbsp;</td>\r\n");
      out.write("    </tr>\r\n");
      out.write("    <tr>\r\n");
      out.write("      <td height=\"101\">&nbsp;</td>\r\n");
      out.write("      <td height=\"101\"><img src=\"F:\\example\\图书馆\\login\\library1.gif\" alt=\"\"></td>\r\n");
      out.write("      <td height=\"101\">&nbsp;</td>\r\n");
      out.write("    </tr>\r\n");
      out.write("    <tr>\r\n");
      out.write("      <td width=\"52\" height=\"300\">&nbsp;</td>\r\n");
      out.write("      <td height=\"300\"><table width=\"60%\" border=\"0\" align=\"center\" cellpadding=\"10\" cellspacing=\"1\">\r\n");
      out.write("        <tr>\r\n");
      out.write("          <td width=\"32%\" align=\"right\"><span class=\"style2\">ID</span></td>\r\n");
      out.write("          <td><input name=\"user\" type=\"text\" id=\"user\" size=\"15\" maxlength=\"12\"></td>\r\n");
      out.write("        </tr>\r\n");
      out.write("        <tr>\r\n");
      out.write("          <td width=\"32%\" align=\"right\"><span class=\"style2\">code</span></td>\r\n");
      out.write("          <td><input name=\"code\" type=\"password\" id=\"code\" size=\"15\" maxlength=\"12\"></td>\r\n");
      out.write("        </tr>\r\n");
      out.write("        <tr align=\"center\" valign=\"top\">\r\n");
      out.write("          <td colspan=\"2\"><select name=\"rights\" size=\"1\" id=\"rights\">\r\n");
      out.write("            <option selected>User</option>\r\n");
      out.write("            <option>Administrator</option>\r\n");
      out.write("          </select></td>\r\n");
      out.write("        </tr>\r\n");
      out.write("        <tr align=\"center\" valign=\"top\">\r\n");
      out.write("          <td colspan=\"2\"><table width=\"80%\"  border=\"0\" cellpadding=\"0\" cellspacing=\"1\">\r\n");
      out.write("            <tr align=\"center\">\r\n");
      out.write("              <td width=\"20%\"><input type=\"submit\" name=\"Submit\" value=\"Enter\"></td>\r\n");
      out.write("              <td width=\"20%\"><input name=\"reset\" type=\"reset\" id=\"reset\" value=\"Reset\"></td>\r\n");
      out.write("            </tr>\r\n");
      out.write("          </table></td>\r\n");
      out.write("          </tr>\r\n");
      out.write("      </table></td>\r\n");
      out.write("      <td width=\"52\" height=\"300\">&nbsp;</td>\r\n");
      out.write("    </tr>\r\n");
      out.write("    <tr>\r\n");
      out.write("      <td width=\"52\">&nbsp;</td>\r\n");
      out.write("      <td><img src=\"F:\\example\\图书馆\\login/library2.png\" width=\"508\" height=\"40\" alt=\"\"></td>\r\n");
      out.write("      <td width=\"52\">&nbsp;</td>\r\n");
      out.write("    </tr>\r\n");
      out.write("  </table>\r\n");
      out.write("</form>\r\n");
      login.Library Library = null;
      synchronized (session) {
        Library = (login.Library) _jspx_page_context.getAttribute("Library", PageContext.SESSION_SCOPE);
        if (Library == null){
          Library = new login.Library();
          _jspx_page_context.setAttribute("Library", Library, PageContext.SESSION_SCOPE);
          out.write('\r');
          out.write('\n');
        }
      }
      out.write('\r');
      out.write('\n');


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();}


      out.write("\r\n");
      out.write("\r\n");
      out.write("</body>\r\n");
      out.write("</html>\r\n");
      out.write("\r\n");
    } catch (Throwable t) {
      if (!(t instanceof SkipPageException)){
        out = _jspx_out;
        if (out != null && out.getBufferSize() != 0)
          out.clearBuffer();
        if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
      }
    } finally {
      if (_jspxFactory != null) _jspxFactory.releasePageContext(_jspx_page_context);
    }
  }
}

⌨️ 快捷键说明

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