![status 404 not found status 404 not found](https://www.copahost.com/blog/wp-content/uploads/2019/02/blog-404-error-code-fix.jpg)
In order to use you only need to make sure that your web.xml file, if any (it’s optional since Servlet 3.0), is declared conform Servlet 3.0+ version and thus not conform e.g.
#STATUS 404 NOT FOUND HOW TO#
Public class YourServlet extends HttpServlet /test, how to map in web.xml? works only on Servlet 3.0 or newer
![status 404 not found status 404 not found](https://im.mtv.fi/image/1589638/landscape16_9/360/203/f0693b6ba963e507053c49c08bc28ce/FQ/1407637.jpg)
package com.example // Use a // This is the URL of the servlet. The URL pattern is to be specified as value of annotation. It’s absolutely not per definition the classname/filename of the servlet class.
![status 404 not found status 404 not found](https://www.lifewire.com/thmb/rITJv9my_z4cHRG4TFBqxXB_FG4=/400x0/filters:no_upscale():max_bytes(150000):strip_icc()/404_error_sample-5a9372623de4230037753936.png)
The servlet URL is specified as the “URL pattern” of the servlet mapping. You can even do without it and put the JSP file directly in webcontent/webapp root, but I’m just taking over this from your question. Note that the /jsps subfolder is not strictly necessary. Below is an example of the folder structure of a default Maven webapp project as seen in Eclipse’s Navigator view: MavenProjectName main/resources, this is for non-class files. In case of a Maven project, the class needs to be placed in its package structure inside main/java and thus not e.g. Below is an example of the folder structure of a default Eclipse Dynamic Web Project as seen in Navigator view: EclipseProjectName In case of a “plain” IDE project, the class needs to be placed in its package structure inside “Java Resources” folder and thus not “WebContent”, this is for web files such as JSP. Packageless servlets work only in specific Tomcat+JDK combinations and this should never be relied upon. This way you eliminiate potential environment-specific problems. You should always put publicly reuseable Java classes in a package, otherwise they are invisible to classes which are in a package, such as the server itself. First of all, put the servlet class in a Java package.