Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HTTP Status 404

 
Mohamed aboelnour
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • 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.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • 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.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64973
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you running this within the IDE?
 
Vinoth Thirunavukarasu
Ranch Hand
Posts: 164
Android Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
See the servlet examples, webapps folder use the same thing to configure your servlet.
Good Luck
 
Sandeep Swaminathan
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • 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
  • 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.
 
Man Kin Lo
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • 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.
 
jyeshta dochi
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • 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>
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic