adm_login.jsp
上传用户:sxlinghang
上传日期:2022-07-20
资源大小:1405k
文件大小:3k
源码类别:

数据库编程

开发平台:

Java

  1. <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
  2. <%@ page session="true" %>
  3. <jsp:useBean id="alogin" scope="page" class="bookshop.run.login" />
  4. <%
  5. String mesg = "";
  6. if( request.getParameter("username")!=null && !request.getParameter("username").equals("")){
  7. String username =request.getParameter("username");
  8. String passwd = request.getParameter("passwd");
  9. username = new String(username.getBytes("ISO8859-1"));
  10. passwd = new String(passwd.getBytes("ISO8859-1"));
  11. alogin.setUsername(username);
  12. alogin.setPasswd(passwd);
  13. alogin.setIsadmin(true);
  14. if (alogin.excute()){
  15. session.setAttribute("admin","admin"); 
  16. response.sendRedirect("adm_user.jsp");
  17. }else {
  18. mesg = "登录出错!" ;
  19. }
  20. }
  21. %>
  22. <script language="javascript">
  23.   function checkform() {
  24. if (document.form1.username.value=="" || document.form1.passwd.value==""){
  25. alert("用户名或密码为空!");
  26. return false;
  27. }
  28. return true;
  29.   }
  30. </script>
  31. <%@include file="/bookshop/inc/adm_head.inc"%>
  32. <tr>
  33. <td>&nbsp;</td>
  34. </tr>
  35. <tr>
  36. <div align="center" bgcolor="#E4EDFB">
  37.   <table width="778" border="0"  cellspacing="0" cellpadding="0" bgcolor="#E4EDFB" align="center">
  38.     <tr> 
  39.       <td align="center"> 
  40.         <form name="form1" method="post" action="adm_login.jsp">
  41.        
  42.           <table width="360" border="0" cellspacing="2" cellpadding="2" bgcolor="#E4EDFB" bordercolor="#66CCFF" style="font-size:9pt">
  43.             <tr align="center"> 
  44.               <td colspan="2"> 
  45.                 <h3><br>
  46.                   <font color="#FF0000">隽隽网上书店管理系统</font></h3>
  47.                 <p>&nbsp;<% if (!mesg.equals("")){
  48. out.println(mesg);}%></p>
  49.               </td>
  50.             </tr>
  51.             <tr> 
  52.               <td align="right" width="150">管理员:</td>
  53.               <td> 
  54.                 <input type="text" name="username" size="12" maxlength="20">
  55.               </td>
  56.             </tr>
  57.             <tr> 
  58.               <td align="right" width="150">管理员密码:</td>
  59.               <td> 
  60.                 <input type="password" name="passwd" size="12" maxlength="20">
  61.               </td>
  62.             </tr>
  63.             <tr align="center"> 
  64.               <td colspan="2"> 
  65.                 <input type="submit" name="Submit" value="登录" onclick="javascript:return(checkform());">
  66.                 <input type="reset" name="Submit2" value="取消">
  67.               </td>
  68.             </tr>
  69.             <tr align="center">
  70.               <td colspan="2">测试用户:admin 密码:admin</td>
  71.             </tr>
  72.             <tr align="center">
  73.               <td colspan="2"><A HREF="../index.jsp">返回首页</A></td>
  74.             </tr>
  75.           </table>
  76.  </form>
  77.         <p>&nbsp;</p>
  78.         
  79.       </td>
  80.     </tr>
  81.   </table>
  82. </div>
  83. </tr>
  84. <%@include file="/bookshop/inc/adm_tail.inc"%>