Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- **test.jsp**
- <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
- pageEncoding="ISO-8859-1"%>
- <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
- <title>Insert title here</title>
- </head>
- <body>
- <script type="text/javascript">
- $('#Form').click(function(e) {
- e.preventDefault();
- $('#Form').submit();
- });
- </script>
- <%
- **String name = "Click here";**
- %>
- <form method="get" id="Form" action="Home.jsp">
- <Input type="Hidden" name="name" id="name" value="<%=name%>">
- <a href="$('#Form').submit();">*Click here*</a>
- </form>
- </body>
- </html>
- **home.jsp**
- <%@page import="java.io.PrintWriter"%>
- <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
- pageEncoding="ISO-8859-1"%>
- <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
- <title>Insert title here</title>
- </head>
- <body>
- <%
- String name = request.getParameter("name");
- PrintWriter ot = response.getWriter();
- ot.print("Name is "+name);
- %>
- </body>
- </html>
- [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