Guest User

Untitled

a guest
Jun 21st, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.39 KB | None | 0 0
  1. **test.jsp**
  2.  
  3. <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
  4. pageEncoding="ISO-8859-1"%>
  5. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  6. <html>
  7. <head>
  8. <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
  9. <title>Insert title here</title>
  10.  
  11. </head>
  12. <body>
  13. <script type="text/javascript">
  14. $('#Form').click(function(e) {
  15. e.preventDefault();
  16. $('#Form').submit();
  17. });
  18. </script>
  19. <%
  20. **String name = "Click here";**
  21. %>
  22. <form method="get" id="Form" action="Home.jsp">
  23. <Input type="Hidden" name="name" id="name" value="<%=name%>">
  24. <a href="$('#Form').submit();">*Click here*</a>
  25. </form>
  26.  
  27.  
  28. </body>
  29. </html>
  30.  
  31.  
  32.  
  33. **home.jsp**
  34. <%@page import="java.io.PrintWriter"%>
  35. <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
  36. pageEncoding="ISO-8859-1"%>
  37. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  38. <html>
  39. <head>
  40. <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
  41. <title>Insert title here</title>
  42. </head>
  43. <body>
  44. <%
  45. String name = request.getParameter("name");
  46. PrintWriter ot = response.getWriter();
  47. ot.print("Name is "+name);
  48. %>
  49. </body>
  50. </html>
  51.  
  52.  
  53. [1]: https://stackoverflow.com/questions/46538529/how-can-i-pass-data-by-clicking-on-href-tag-in-jsp/46538830
Add Comment
Please, Sign In to add comment