Win a copy of Head First Android this week in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

HTTP Status 404

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Peace be upon you:

hi all,

I'm new in the Java web programing so I installed Netbeans 6.7.1 to work with Java EE and Tomcat.
I Wirte A simple Code in index.jsp

and I Write A Servlet class:


When I Run the index.jsp appear and I entered a String in the text Field and press the Button
It Supposed to print "hi,"+ the String
But this appear:

Any help is appreciated.
Thanks in advance.
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Where's your web.xml file and the servlet mapping?

It's also unusual to use .java as the servlet extension.
 
Sheriff
Posts: 67595
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are you running this within the IDE?
 
Ranch Hand
Posts: 164
Android Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
See the servlet examples, webapps folder use the same thing to configure your servlet.
Good Luck
 
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In the ACTION attribute of FORM TAG you are supposed to use only the name mentioned in the <URL-MAPPING> of the WEB.XML file
That is


Also make sure in the ACTION attribute you give something like this


 
Mohamed aboelnour
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Sandeep Swaminathan wrote:In the ACTION attribute of FORM TAG you are supposed to use only the name mentioned in the <URL-MAPPING> of the WEB.XML file
That is


Also make sure in the ACTION attribute you give something like this




thanks it works

thanks to every one Reply to my problem.

Can Any one advice to me a good reference to Servlet and JSP?
thanks in advance.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
http://www.apl.jhu.edu/~hall/java/Servlet-Tutorial/
This should provide you the basic understanding to JSP and Servlets. Good luck.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
you have specified url in form->action "web-inf/newfile.java". note that you have specified url and not servlet.Please avoid that and jus give some name: "/newfile".this url shud be mapped in web.xml


<servlet>
<servlet-name>/newfile</servlet-name>
<servlet-class>NewFile</servlet-class> :NewFile is Servlet here
</servlet>

<servlet-mapping>
<servlet-name>Display</servlet-name>
<url-pattern>/newfile</url-pattern> :newfile is url here. Shud be specified in form action
</servlet-mapping>
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic