aspose file tools *
The moose likes Servlets and the fly likes HTTP 404 Error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "HTTP 404 Error" Watch "HTTP 404 Error" New topic
Author

HTTP 404 Error

Rameshwar Soni
Ranch Hand

Joined: Feb 03, 2011
Posts: 247
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

Joined: Jul 09, 2011
Posts: 272

The value of action attribute of Form tag should match the URL pattern of the servlet specified in the web.xml


Ashwin Sridhar
SCJP | SCWCD | OCA
Prashant Chindhade
Ranch Hand

Joined: Jan 19, 2011
Posts: 77
simply put My_Demo in the action attribute in html file
Vigneswaran Marimuthu
Greenhorn

Joined: Aug 30, 2011
Posts: 24

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


Regards,

Vigneswaran.M
Rameshwar Soni
Ranch Hand

Joined: Feb 03, 2011
Posts: 247
Thanks everyone for their suggestion...Its finally running
Vigneswaran Marimuthu
Greenhorn

Joined: Aug 30, 2011
Posts: 24

that's great... Even i am learning JAVA. basically i am from ECE.
Rameshwar Soni
Ranch Hand

Joined: Feb 03, 2011
Posts: 247
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

Joined: Mar 22, 2000
Posts: 12839
    
    5
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

Joined: Feb 03, 2011
Posts: 247
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

Joined: Aug 30, 2011
Posts: 24

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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: HTTP 404 Error