I am new to Servlets. I made a simple project with 2 jsp files. and two Servlers jsp1, jsp2, servlet1 and servlet2.
When the code in both jsps' body tags is this (Both points to servlet1 )
<form method="post" action="servlet1">
<input type="submit">
</form>`
and There is a simple Sysout in the servlets' doPost method..
It works perfectly fine in this scenario.
But when I make the second jsp call servlet2. It doesn't work. It gives me this error screen
HTTP Status 404 - /Project/servlet2 type Status report message /Project/servlet2 description The requested resource (/Project/servlet2) is not available. Apache Tomcat/6.0.26
So can't we use two different servlets in same project?
EDIT:
This is the web.xml file. As you can see. All mappings are there.
'
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
<display-name>Project</display-name>
<welcome-file-list>
<welcome-file>jsp1.jsp</welcome-file>
</welcome-file-list>
<servlet>
<description></description>
<display-name>servler1</display-name>
<servlet-name>servler1</servlet-name>
<servlet-class>servler1</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>servler1</servlet-name>
<url-pattern>/servler1</url-pattern>
</servlet-mapping>
<servlet>
<description></description>
<display-name>servler2</display-name>
<servlet-name>servler2</servlet-name>
<servlet-class>servler2</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>servler2</servlet-name>
<url-pattern>/servler2</url-pattern>
</servlet-mapping>
</web-app>
'