Search code examples
javajspservletsweb.xmlurl-mapping

page not found on jsp submission


here is my test.jsp placed at webcontent/jsp/

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<form action="employee.do" method="get">
<input type="text" name="name1">
<input type="submit" name="add employee" />
</form>
</body>
</html>

Now here is servlet mapping in web.xml

 <servlet>
    <servlet-name>EmployeeServlet</servlet-name>
    <servlet-class>com.controller.EmployeeServlet</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>EmployeeServlet</servlet-name>
    <url-pattern>/employee.do</url-pattern>
  </servlet-mapping>
  <servlet>

Now when I submit this form to my employee.do then server says page not found.I dont know why it is happening?I am using tomcat server
Edit: When I place this jsp page outside the jsp folder , mean direct in the webcontent folder then it works fine and submit the form.Why it is not submitting the form under jsp folder


Solution

  • Keep the jsp file directly under web-content or change the url mapping to /jsp/employee.do .