Forum Stats

  • 3,837,914 Users
  • 2,262,307 Discussions


How to solve HTTP status 404 error when using @WebServlet annotation?

User_QGDP7 Member Posts: 1 Green Ribbon

Hi everyone,I am a beginner of Servlet.

I want to replace web.xml with annotation @WebServlet to specify the url.Here's my servlet class annotation.


But I got a 404 NotFound error when I ran the project and entered "localhost/demo1"(port is set to 80) in Browser's url input field.I have checked the configuration in web.xml,in which the version is 4.0 and metadata-complete is false.

I have searched on net for a long time.But no use.Please help or try to give some ideas about how to achieve this.

Thanks in advance.