Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HTTP 404 Error

 
Rameshwar Soni
Ranch Hand
Posts: 247
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello to everyone....
I am trying a very simple example on servlet. When i do my coding in Netbeans it works fine but we all know that doing programs in Notepad is always good for beginners so when i did i get the 404 error. I am using Tomcat 5.5
.
1) My HTML file saved as Basic_Servlet.html

.
2)My servlet saved as My_Demo.java

.
.
3) My web.xml

.
.
Thanks in advance.
 
Ashwin Sridhar
Ranch Hand
Posts: 277
Flex Oracle Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The value of action attribute of Form tag should match the URL pattern of the servlet specified in the web.xml
 
Prashant Chindhade
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
simply put My_Demo in the action attribute in html file
 
Vigneswaran Marimuthu
Greenhorn
Posts: 24
Eclipse IDE Oracle Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
http:\\localhost:8080\servlets-examples\servlet\My_Demo

i guess everything is right. but error in the url pattern. use - http://localhost:8080/servlets-examples/servlet/My_Demo
 
Rameshwar Soni
Ranch Hand
Posts: 247
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks everyone for their suggestion...Its finally running
 
Vigneswaran Marimuthu
Greenhorn
Posts: 24
Eclipse IDE Oracle Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
that's great... Even i am learning JAVA. basically i am from ECE.
 
Rameshwar Soni
Ranch Hand
Posts: 247
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Vigneswaran Marimuthu wrote:that's great... Even i am learning JAVA. basically i am from ECE.

Same here learning Java but i am from IT.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13056
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Unfortunately, you are still having a problem. By placing code under the servlet examples, you are actually making use of the dreaded Invoker Servlet.

This unfortunate invention, which was intended to make it easy for beginners, lets you get away with servlet classes not defined in a package. Thus failing when you attempt to deploy anywhere but the examples.

See numerous examples in this forum history.

Bill
 
Rameshwar Soni
Ranch Hand
Posts: 247
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
William Brogden wrote:Unfortunately, you are still having a problem. By placing code under the servlet examples, you are actually making use of the dreaded Invoker Servlet.

Thank you for explaining a topic "Invoker Servlet" which i never knew.
 
Vigneswaran Marimuthu
Greenhorn
Posts: 24
Eclipse IDE Oracle Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks William for your information about invoker servlet. I am using web.xml of WEB-INF folder to map servlets because in our company eclipse is the IDE Now i came to know about INVOKER SERVLET
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic