pwd.jsp 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. <%@page contentType="text/html;charset=UTF-8"%>
  2. <%@page import="org.springframework.context.ApplicationContext"%>
  3. <%@page import="org.springframework.web.context.support.WebApplicationContextUtils"%>
  4. <%@page import="com.mossle.security.util.SimplePasswordEncoder"%>
  5. <%
  6. if (request.getParameter("password") != null) {
  7. ApplicationContext ctx = WebApplicationContextUtils.getWebApplicationContext(application);
  8. SimplePasswordEncoder simplePasswordEncoder = (SimplePasswordEncoder) ctx.getBean("simplePasswordEncoder");
  9. pageContext.setAttribute("encodedPassword", simplePasswordEncoder.encode(request.getParameter("password")));
  10. }
  11. %>
  12. <html>
  13. <head>
  14. <meta charset="utf-8">
  15. <title>pwd</title>
  16. <style>
  17. tbody tr:nth-child(odd) td,
  18. tbody tr:nth-child(odd) th {
  19. background-color: #f9f9f9;
  20. }
  21. </style>
  22. </head>
  23. <body>
  24. <form action="pwd.jsp" method="post">
  25. <label>password:</label><input type="input" name="password" value="${param.password}"><br>
  26. <label>encodedPassword: ${encodedPassword}<label><br>
  27. <input type="submit">
  28. </form>
  29. <hr>
  30. admin : 21232f297a57a5a743894a0e4a801fc3
  31. <br>
  32. user : ee11cbb19052e40b07aac0ca060c23ee
  33. <br>
  34. </body>
  35. </html>