Advertisement
Guest User

Untitled

a guest
Feb 8th, 2016
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. @WebServlet("/logincontrol")
  2. public class SessionController extends HttpServlet {
  3. private static final long serialVersionUID = 1L;
  4. public SessionController() {
  5. super();
  6. }
  7. @RequestMapping(value="/logincontrol")
  8. protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
  9.  
  10. request.getSession().setAttribute("name",request.getParameter("password"));
  11. response.getWriter().println("Hello World!");
  12. }
  13. }
  14.  
  15. <form name="loginForm" action="logincontrol">
  16.  
  17. <table>
  18. <tr>
  19. <td>User:</td>
  20. <td><input type='text' name='name'></td>
  21. </tr>
  22. <tr>
  23. <td>Password:</td>
  24. <td><input type='password' name='password' /></td>
  25. </tr>
  26. <tr>
  27. <td colspan='2'><input name="submit" type="submit"
  28. value="submit" /></td>
  29. </tr>
  30. </table>
  31. <%--
  32. <input type="hidden" name="${_csrf.parameterName}"
  33. value="${_csrf.token}" /> --%>
  34.  
  35. </form>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement