UserLogin.jsp
上传用户:sxychgz
上传日期:2019-04-21
资源大小:4772k
文件大小:1k
源码类别:

电子政务应用

开发平台:

Java

  1. <%@ page language="java" contentType="text/html; charset=GB18030" import="com.bjsxt.shopping.user.*"
  2.     pageEncoding="GB18030"%>
  3. <%
  4. String action = request.getParameter("action");
  5. if(action != null && action.equals("login")) {
  6. String username = request.getParameter("username");
  7. String password = request.getParameter("password");
  8. User u = null;
  9. try {
  10. u = User.check(username, password);
  11. } catch (UserNotFoundException e) {
  12. out.println(e.getMessage());
  13. return;
  14. } catch (PasswordNotCorrectException e) {
  15. out.println(e.getMessage());
  16. return;
  17. }
  18. session.setAttribute("user", u);
  19. response.sendRedirect("Confirm.jsp");
  20. }
  21. %>
  22. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  23. <html>
  24. <head>
  25. <meta http-equiv="Content-Type" content="text/html; charset=GB18030">
  26. <title>Insert title here</title>
  27. </head>
  28. <body>
  29. <form action="UserLogin.jsp" method="post">
  30. <input type="hidden" name="action" value="login"/>
  31. <table border="1" align="center">
  32. <tr>
  33. <td>username:</td>
  34. <td><input type="text" size="10" name="username"/></td>
  35. </tr>
  36. <tr>
  37. <td>password:</td>
  38. <td><input type="password" size="10" name="password"/></td>
  39. </tr>
  40. <tr>
  41. <td></td>
  42. <td><input type="submit" value="login"/><input type="reset" value="reset"/></td>
  43. </tr>
  44. </table>
  45. </form>
  46. </body>
  47. </html>