Explain Hidden form using Servlet and JSP with example?


Hidden form is just like a text box but they are hidden to view page. Helps us to pass information from once page to another.

 

Example

Page 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>


<h1>Hidden form Example</h1><br>

<h3>Registration form page 1</h3><br>

	<form action="registration2.jsp" method="post">
		Name : <input type="text" name="name"> <br> 
		Email : <input type="text" name="email"> <br> 
		<input type="submit" value="Next">
	</form>


</body>
</html>

Page 2

<!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");
String email=request.getParameter("email");

%>
<h3>Registration form page 2</h3><br>

<form action="HiddenFormTest" method="post">

                        <input type="hidden" name="name" value="<%=name%>">
			<input type="hidden" name="email" value="<%=email%>">

			
		Age : <input type="text" name="age"> <br> 
		Country : <input type="text" name="country"> <br> 
		<input type="submit" value="Register">
	</form>

</body>
</html>


Screenshot

            

            

            


Download

            Hidden form example war

            Hidden for example zip



Related Post

Comments


©candidjava.com