The requested resource is not available for servlet 3.0 and tomcat 7.0

My version of the dynamic web module is 3.0, and tomcat is my version of tomcat 7.0 .

I do not know why it cannot see my XD servlet when I go to the localhost: 8080 / SimpleProject page .

When I go to localhost: 8080 / SimpleProject / firstservlet , I get the error message the requested resource is not available!

Here is my servlet:

 @WebServlet(description = "the first servlet", urlPatterns = { "/firstservlet" }) public class FirstServlet extends HttpServlet { private static final long serialVersionUID = 1L; protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // response.setContentType("text/html"); PrintWriter writer = response.getWriter(); writer.println("<h1>Why can't See<h1>"); } 

I did nothing in my web.xml, because what I know is in version 3.0, the URL is displayed in the servlet.

enter image description here

This is my file location :) enter image description here

+7
source share
1 answer

Do you check the log files to see if there is any exception when loading / executing your FirstServlet servlet?

You checked the contents of your war file to make sure it is properly packed and the servlet class is in it (you can open the war file as if it were a zip file).

0
source

All Articles