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

📄 login_jsp.java

📁 一个超市管理系统,提供一些基本简单的操作,JSP+APACHE+ORCALE实现
💻 JAVA
字号:
package org.apache.jsp;

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

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

  private static java.util.List _jspx_dependants;

  public Object 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,
      			null, 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("\n");
      out.write("<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\n");
      out.write("<html>\n");
      out.write("<head>\n");
      out.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=gb2312\">\n");
      out.write("<title>登录</title>\n");
      out.write("</head>\n");
      out.write("<body>\n");
      bb.Dbcon Dbcon = null;
      synchronized (_jspx_page_context) {
        Dbcon = (bb.Dbcon) _jspx_page_context.getAttribute("Dbcon", PageContext.PAGE_SCOPE);
        if (Dbcon == null){
          Dbcon = new bb.Dbcon();
          _jspx_page_context.setAttribute("Dbcon", Dbcon, PageContext.PAGE_SCOPE);
        }
      }
      out.write('\r');
      out.write('\n');
      bb.login login = null;
      synchronized (session) {
        login = (bb.login) _jspx_page_context.getAttribute("login", PageContext.SESSION_SCOPE);
        if (login == null){
          login = new bb.login();
          _jspx_page_context.setAttribute("login", login, PageContext.SESSION_SCOPE);
        }
      }
      out.write('\n');

  String username=request.getParameter("username");
  String password=request.getParameter("password");
  String password1="";
  ResultSet rs=null;
  
  Connection con=Dbcon.getConn();
  String sql="select * from tpb.staffer where user0='"+username+"'";
  Statement stmt=con.createStatement();
  rs=stmt.executeQuery(sql);
  if (rs.next())
  {
      password1=rs.getString("password0");
      String job=rs.getString("job");
      if(password.equals(password1))
      {
    	  login.setMyuser(username);
          login.setMypassword(password);
	      if (job.equals("进货人员"))
	      {
		      login.setDept1();
	          response.sendRedirect("stock.jsp");
          }
	      else if(job.equals("销售人员"))
          {
		      login.setDept2();
             response.sendRedirect("sell.jsp");
          }
	      else if(job.equals("职工管理人员"))
          {
		      login.setDept3();
              response.sendRedirect("staffer.jsp");
          }
	      else if(job.equals("财务管理人员"))
          {
		      login.setDept4();
              response.sendRedirect("finance.jsp");
          }
	      else if(job.equals("经理"))
          {
	    	  login.setDept5();
              response.sendRedirect("manager.jsp");
          }
       }
  }

      out.write("\r\n");
      out.write("<h1 align=\"center\">用户名或密码错误</h1>\r\n");
      out.write("返回登录页面:\r\n");
      out.write("<a href=\"index.jsp\">返回</a>\r\n");
 
 rs.close();
 stmt.close();
 Dbcon.Close();

      out.write("\r\n");
      out.write("</body>\r\n");
      out.write("</html>");
    } 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 + -