I have two files. One is form.html
and another is form2.jsp
I want to process form2.jsp
by using form action element in the form.html
, but after clicking on submit in form.html
, the action element is not working. Both files are in the same directory i.e. WebContent folder in webapplication.
<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<title>Registration Form</title>
</head>
<body>
<form name="form" action="form2.jsp" method="get">
First Name : <input type="text" name="fname">
Last Name : <input type="text" name="lname">
<input type ="button" value="Submit" />
</form>
</body>
</html>
<%@ 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>
<%
out.println("Hello from form2'");
%>
</body>
</html>
change this,
<input type ="button" value="Submit" />
With
<input type ="submit" value="Submit" />
or with
<button type="submit">Submit</Button>