servlet,html form problem
Servlet,html form problem?
Hi,this is hancok.I am getting the error when I click submit button after filling the fileds of the form.
the eror is as follows.
This webpage is not found.
No webpage was found for the web address: file:///C:/formapp/f1?text1=madhu&age=18…
More information on this error
Below is the original error message
Error 6 (net::ERR_FILE_NOT_FOUND): The file or directory could not be found.
I have the Form1 class in C:\Tomcat 5.0\webapps\formapp\WEB-INF\classes
I have the classes folder and web.xml in C:\Tomcat 5.0\webapps\formapp\WEB-INF
my Form1 class is as follows,
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class Form1 extends HttpServlet{
public void doGet(HttpServletRequest request,HttpServletResponse response)throws ServletException,IOException{
response.setContentType("text/html");
PrintWriter out = response.getWriter();
String name,add;
int age;
name = request.getParameter("text1");
add = request.getParameter("text3");
age = Integer.parseInt(request.getParameter("t…
if(age>=18){
out.println("<h1>Registration successfully completed");
out.println("fashion ticket will be dispatched");
} else{
out.println("<br> <br>you are not eligible");
}
}
}
my web.xml is as follows,
<web-app>
<servlet>
<servlet-name>my</servlet-name>
<servlet-class>Form1</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>my</servlet-name>
<url-pattern>/f1</url-pattern>
</servlet-mapping>
</web-app>
i have the form1.html file and WEB-INF in C:\Tomcat 5.0\webapps\formapp
my html file is as follows,
<html>
<head><title>Registration Form</title></head>
<body>
<h2><br><br><form name="form1" method="get" action="/formapp/f1">
Enter name:<input type="text" name=" name=" />
<br>
Enter age:<input type="text" />
<br>
Enter age:<input type="age" name="text" />
<br>
Enter address:<input type="address" name="submit" />
<br>
<input type="submit" />
<br>
</form>
</body>
</html>
when I click on the html file, then I get ,
Enter name:
Enter age:
Enter address:
but,after entering details in the fields I click the submit button
but it won't call the servlet(Form1.java) instead the browser shows the error as follows,
This webpage is not found.
No webpage was found for the web address: file:///C:/formapp/f1?text1=ma&age=18&ad…
More information on this error
Below is the original error message
Error 6 (net::ERR_FILE_NOT_FOUND): The file or directory could not be found.
|