I have created a Maven Project with Dynamic web module enabled in Eclipse.
I have a index.html page that has a form which sends data to a Servlet.
My WEB-INF/web.xml looks like this:
<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd" >
<web-app>
<display-name>Archetype Created Web Application</display-name>
<servlet>
<servlet-name>test</servlet-name>
<display-name>test</display-name>
<description></description>
<servlet-class>servlet.test</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>test</servlet-name>
<url-patte>/testing</url-patte>
</servlet-mapping>
</web-app>
I have a servlet named test under Java Resources/src/main/resources/servlet/test.java
I did Run as Maven Clean > Build success. Then again Run as Maven Build > Goals- package > Run > Build Success.
Then ran the code in Tomcat server.
I am able to see my index.html page but on submitting the form I am getting the following error:
HTTP Status 404 - /servletsample/test
type Status report
message /servlettest/inttest
description The requested resource is not available.
servletsample is my Project name.
My pom.xml is like this:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org</groupId>
<artifactId>servlettest</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>servlettest Maven Webapp</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20090211</version>
</dependency>
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<version>1.1.1</version>
</dependency>
</dependencies>
<build>
<finalName>servletsample</finalName>
</build>
</project>
Any idea how I can fix the issue? Thanks.
