Win a copy of Getting started with Java programming language this week in the Beginning Java forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Servlet not found - 404 error  RSS feed

 
tushar attar
Ranch Hand
Posts: 39
Chrome Java Notepad
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have started servlets few hours ago. Now i  have created a very simple servlet which is called from a html form. But instead of loading servlet i am getting 404 error.
I have created a directory myapp under webapps folder. Created WEB-INF folder in myapp folder and further classes folder in WEB-INF and placed servlet class file there.  Also I have created web.xml file and placed it in WEB-INF folder. HTML file is located directly under myapp folder. Following are the codes for java, xml and html file.

PostParameterServlet.java




web.xml



a.html



I have tried using links:

localhost:8080/myapp/servlet/pps
localhost:8080/myapp/servlet/PostParameterServlet
localhost:8080/pps

Still no success, Please tell me where i am going wrong and what is the correct solution



 
Paul Clapham
Sheriff
Posts: 22122
36
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Your servlet classes need to be in a package or the server will not be able to run them.
 
tushar attar
Ranch Hand
Posts: 39
Chrome Java Notepad
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, it worked
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!