Advertisement
Guest User

Untitled

a guest
Mar 30th, 2016
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. <body>
  2. <%!
  3. String username=null;
  4. String password=null;
  5. %>
  6. <%
  7. Cookie [] cookies=request.getCookies();
  8. if(cookies!=null) {
  9. for (int i = 0; i < cookies.length; i++) {
  10. if (cookies[i].getName().equals("username")) {
  11. username = cookies[i].getValue();
  12. }
  13. }
  14. }
  15. %>
  16. <form action="/helloworld" method="post">
  17. <input type="text" name="name" value="<%=username%>">
  18. <input type="submit">
  19. </form>
  20. </body>
  21.  
  22. if(cookies!=null)
  23.  
  24. Servlet.service() for servlet [jsp] in context with path [] threw exception [An exception occurred processing JSP page /index.jsp at line 20
  25.  
  26. 17: %>
  27. 18: <%
  28. 19: Cookie [] cookies=request.getCookies();
  29. 20: for(int i=0;i<cookies.length;i++){
  30. 21: if(cookies[i].getName().equals("username")) {
  31. 22: username=cookies[i].getValue();
  32. 23: }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement