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

📄 login_jsp.java

📁 Tomcat 是一个小型的轻量级应用服务器
💻 JAVA
字号:
package org.apache.jsp;

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

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

  private static final JspFactory _jspxFactory = JspFactory.getDefaultFactory();

  private static java.util.List _jspx_dependants;

  private javax.el.ExpressionFactory _el_expressionfactory;
  private org.apache.AnnotationProcessor _jsp_annotationprocessor;

  public Object getDependants() {
    return _jspx_dependants;
  }

  public void _jspInit() {
    _el_expressionfactory = _jspxFactory.getJspApplicationContext(getServletConfig().getServletContext()).getExpressionFactory();
    _jsp_annotationprocessor = (org.apache.AnnotationProcessor) getServletConfig().getServletContext().getAttribute(org.apache.AnnotationProcessor.class.getName());
  }

  public void _jspDestroy() {
  }

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

    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 {
      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("\r\n");
      com.bookshop.dao.Login alogin = null;
      synchronized (_jspx_page_context) {
        alogin = (com.bookshop.dao.Login) _jspx_page_context.getAttribute("alogin", PageContext.PAGE_SCOPE);
        if (alogin == null){
          alogin = new com.bookshop.dao.Login();
          _jspx_page_context.setAttribute("alogin", alogin, PageContext.PAGE_SCOPE);
        }
      }
      out.write('\r');
      out.write('\n');

	String mesg = "";
	if (request.getParameter("username") != null
			&& !request.getParameter("username").equals(""))
	{
		String username = request.getParameter("username");
		String passwd = request.getParameter("passwd");
		username = new String(username.getBytes("ISO8859-1"));
		passwd = new String(passwd.getBytes("ISO8859-1"));
		alogin.setUsername(username);
		alogin.setPasswd(passwd);
		if (alogin.excute())
		{
			session.setAttribute("username", username);
			String userid = Long.toString(alogin.getUserid());
			session.setAttribute("userid", userid);
			response.sendRedirect("userinfo.jsp");

      out.write('\r');
      out.write('\n');

		} else
		{
			mesg = "登录出错!";
		}
	}

      out.write("\r\n");
      out.write("\r\n");
      out.write("<html>\r\n");
      out.write("\t<head>\r\n");
      out.write("\t\t<title>51网络电子书店--用户登录</title>\r\n");
      out.write("\t\t<meta http-equiv=\"Content-Type\" content=\"text/html; charset=gb2312\">\r\n");
      out.write("\t\t<style>a{TEXT-DECORATION:none}a:hover{TEXT-DECORATION:underline}</style>\r\n");
      out.write("\t\t<script language=\"JavaScript\">\r\n");
      out.write("\t\tsetInterval(\"a.innerHTML=new Date().toLocaleString()+' 星期'+'日一二三四五六'.charAt(new Date().getDay());\",1000);\r\n");
      out.write("\t\t</script>\r\n");
      out.write("\t\t<script language=\"javascript\">\r\n");
      out.write("\r\n");
      out.write(" function checkform() {\r\n");
      out.write("\tif (document.form1.username.value==\"\" || document.form1.passwd.value==\"\"){\r\n");
      out.write("\t\talert(\"用户名或密码为空!\");\r\n");
      out.write("\t\treturn false;\r\n");
      out.write("\t}\r\n");
      out.write("\treturn true;\r\n");
      out.write("\r\n");
      out.write("  }\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 {color: #000000}\r\n");
      out.write(".style14 {color: #3366FF}\r\n");
      out.write(".style16 {font-size: 18px; color: #3366FF;}\r\n");
      out.write("-->\r\n");
      out.write("</style>\r\n");
      out.write("\t\t<link rel=\"stylesheet\" href=\"books.css\" type=\"text/css\">\r\n");
      out.write("\t</head>\r\n");
      out.write("\r\n");
      out.write("\t<body text=\"#000000\">\r\n");
      out.write("\t\t<div align=\"center\">\r\n");
      out.write("\t\t\t<table width=\"750\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\r\n");
      out.write("\t\t\t\t<tr>\t\t\t\t\t\r\n");
      out.write("\t\t\t\t\t<td align=\"center\"><img src=\"images/title.jpg\" width=\"750\" height=\"100\"></td>\r\n");
      out.write("\t\t\t\t</tr>\r\n");
      out.write("\t\t\t</table>\r\n");
      out.write("\r\n");
      out.write("\t\t\t<table width=\"750\" border=\"0\" cellspacing=\"1\" cellpadding=\"1\" >\r\n");
      out.write("\t\t\t\t<tr>\r\n");
      out.write("\t\t\t\t  <td width=\"100\" height=\"30\" align=\"center\" background=\"images/qntj.jpg\"><a href=\"index.jsp\" class=\"style14\">首页</a></td>\r\n");
      out.write("\t\t\t\t  <td width=\"100\" align=\"center\" background=\"images/qntj.jpg\"><a href=\"booklist.jsp\" class=\"style14\">在线购物</a></td>\r\n");
      out.write("\t\t\t\t  <td width=\"100\" align=\"center\" background=\"images/qntj.jpg\"><a href=\"shoperlist.jsp\" class=\"style14\">我的购物车</a></td>\r\n");
      out.write("\t\t\t\t  <td width=\"100\" align=\"center\" background=\"images/qntj.jpg\"><a href=\"login.jsp\" class=\"style14\">用户登录</a></td>\r\n");
      out.write("\t\t\t\t  <td width=\"100\" align=\"center\" background=\"images/qntj.jpg\"><a href=\"manage/login.jsp\" class=\"style14\">网站管理</a></td>\r\n");
      out.write("\t\t\t\t  <td width=\"250\" align=\"center\" background=\"images/qntj.jpg\"><div id=\"a\"><span class=\"style7\"></span></div></td>\r\n");
      out.write("\t\t\t\t</tr>\r\n");
      out.write("\t\t  </table>\r\n");
      out.write("\t\t\t<p class=\"style16\">\r\n");
      out.write("\t\t\t\t51书店用户登录\r\n");
      out.write("\t\t\t</p>\r\n");
      out.write("\t\t\t");

				if (!mesg.equals(""))
				{
					out.println("<p>" + mesg + "</p>");
				}
			
      out.write("\r\n");
      out.write("\t\t\t<form name=\"form1\" method=\"post\" action=\"login.jsp\">\r\n");
      out.write("\t\t\t\t<table width=\"400\" border=\"0\" cellspacing=\"1\" cellpadding=\"1\">\r\n");
      out.write("\t\t\t\t\t<tr>\r\n");
      out.write("\t\t\t\t\t\t<td width=\"147\" height=\"25\" align=\"right\">\r\n");
      out.write("\t\t\t\t\t\t\t<span class=\"style14\">用户名</span><br>\r\n");
      out.write("\t\t\t\t\t  </td>\r\n");
      out.write("\t\t\t\t\t\t<td width=\"246\" valign=\"top\" height=\"25\">\r\n");
      out.write("\t\t\t\t\t\t\t<input type=\"text\" name=\"username\" size=\"16\" maxlength=\"25\" height=\"20\">\r\n");
      out.write("\t\t\t\t\t\t</td>\r\n");
      out.write("\t\t\t\t\t</tr>\r\n");
      out.write("\t\t\t\t\t<tr>\r\n");
      out.write("\t\t\t\t\t\t<td width=\"147\" height=\"25\" align=\"right\" class=\"style14\">\r\n");
      out.write("\t\t\t\t\t\t密 码</td>\r\n");
      out.write("\t\t\t\t\t\t<td width=\"246\" valign=\"top\" height=\"26\">\r\n");
      out.write("\t\t\t\t\t\t\t<input type=\"password\" name=\"passwd\" maxlength=\"20\" size=\"16\" height=\"20\">\r\n");
      out.write("\t\t\t\t\t\t</td>\r\n");
      out.write("\t\t\t\t\t</tr>\r\n");
      out.write("\t\t\t\t\t<tr>\r\n");
      out.write("\t\t\t\t\t\t<td width=\"147\" height=\"25\" align=\"right\">&nbsp;\r\n");
      out.write("\t\t\t\t\t\t\t\r\n");
      out.write("\t\t\t\t\t  </td>\r\n");
      out.write("\t\t\t\t\t\t<td width=\"246\" valign=\"top\" height=\"25\">\r\n");
      out.write("                          <input type=\"submit\" name=\"Submit\" value=\"登录\"\r\n");
      out.write("\t\t\t\t\t\t\t\tonClick=\"javascript:return(checkform());\">\t\t\t\t\t\t\t\r\n");
      out.write("                          <input type=\"reset\" name=\"Submit2\" value=\"取消\">\r\n");
      out.write("\t\t\t\t\t  </td>\r\n");
      out.write("\t\t\t\t\t</tr>\r\n");
      out.write("\t\t\t\t\t<tr>\r\n");
      out.write("\t\t\t\t\t\t<td colspan=\"2\" align=\"center\">\r\n");
      out.write("\t\t\t\t\t\t\t<p>&nbsp;\r\n");
      out.write("\t\t\t\t\t\t\t\t\r\n");
      out.write("\t\t\t\t\t\t  </p>\r\n");
      out.write("\t\t\t\t\t\t\t<p>\r\n");
      out.write("\t\t\t\t\t\t\t\t如果你还不是本站用户,请在此\r\n");
      out.write("\t\t\t\t\t\t\t\t<a href=\"reg.jsp\" class=\"style16\">注册</a>\r\n");
      out.write("\t\t\t\t\t\t\t</p>\r\n");
      out.write("\t\t\t\t\t\t</td>\r\n");
      out.write("\t\t\t\t\t</tr>\r\n");
      out.write("\t\t\t\t</table>\r\n");
      out.write("\t\t\t    <p>&nbsp;</p>\r\n");
      out.write("\t\t\t    <p>&nbsp;</p>\t\r\n");
      out.write("\t\t\t    <p>&nbsp;</p>\r\n");
      out.write("\t\t\t    <p>&nbsp;</p>\t\t \r\n");
      out.write("\t\t\t</form>\t\t\t\r\n");
      out.write("\t\t\t<hr width=\"750\" color=\"#00CCFe\"/>\r\n");
      out.write("\t\t\t<table width=\"750\" border=\"0\"   cellspacing=\"0\" cellpadding=\"0\">\r\n");
      out.write("\t\t\t\t<tr>\r\n");
      out.write("\t\t\t\t\t<td align=\"center\" >\r\n");
      out.write("\t\t\t\t\t\t<div align=\"center\" class=\"style11\">51网络有限公司开发\r\n");
      out.write("\t\t\t\t\t\t  <br>\r\n");
      out.write("\t\t\t\t\t\tCopyRight@2008\r\n");
      out.write("\t\t\t\t\t\t<br>\r\n");
      out.write("\t\t\t\t\t\tE-mail:\r\n");
      out.write("\t\t\t\t\t\t<a href=\"mailto:dengxianghai2005@163.com\">dengxianghai2005@163.com</a>\r\n");
      out.write("\t\t\t\t\t    </div></td>\r\n");
      out.write("\t\t\t\t</tr>\r\n");
      out.write("\t\t\t</table>\r\n");
      out.write("\r\n");
      out.write("\t\t</div>\r\n");
      out.write("\t</body>\r\n");
      out.write("</html>\r\n");
    } catch (Throwable t) {
      if (!(t instanceof SkipPageException)){
        out = _jspx_out;
        if (out != null && out.getBufferSize() != 0)
          try { out.clearBuffer(); } catch (java.io.IOException e) {}
        if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
      }
    } finally {
      _jspxFactory.releasePageContext(_jspx_page_context);
    }
  }
}

⌨️ 快捷键说明

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