| Author |
Resource not found
|
Hatim Khalifa
Greenhorn
Joined: Mar 08, 2007
Posts: 5
|
|
Hi there... It's my first time to develop web application using NetBeans which Tomcat comes bundeled with it. I am very frustrated though because I couldn't load my servlet when requested via an HTML form. I made sure that everything is in place and correct but Tomcat always generate a page that indicates that the resource "servlet" not found. Here is some of my code and config: web.xml
<servlet> <servlet-name>logger</servlet-name> <servlet-class>Log</servlet-class> </servlet> <servlet-mapping> <servlet-name>logger</servlet-name> <url-pattern>/P</url-pattern> </servlet-mapping>
HTML Form
<form method="POST" action="/P"> <input type="text" name="uname" size="20"> <input type="text" name="password" size="20"></p> <input type="submit"> </form >
Although, NetBeans automatically includes Log.class in classes folder, Tomcat still cannot locate the resource. Please, guide me. Thank you in advance
|
Hatim O. Khalifa<br />SCJP, SCJD
|
 |
Ben Souther
Sheriff
Joined: Dec 11, 2004
Posts: 13410
|
|
Try taking the slash out of the form's action attribute: If that doesn't work, post back with the URL that you're using to get to the HTML page with the form in it. Also post the full path to your servlet (ex c:\tomcat\webapps\.....). [ March 16, 2007: Message edited by: Ben Souther ]
|
Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56218
|
|
|
What is the context path of your application.
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
Hatim Khalifa
Greenhorn
Joined: Mar 08, 2007
Posts: 5
|
|
Hi... Well, the context path is /Book. However, I tried many url pattern variations and non of them worked. I tried things like:
/Book/P /P /Book/servlet/P /servlet/P
But, I never tried linking to "P" alone. I will try it and then let you know what happen. Thank you for your help.
|
 |
Ben Souther
Sheriff
Joined: Dec 11, 2004
Posts: 13410
|
|
Originally posted by Ben Souther: If that doesn't work, post back with the URL that you're using to get to the HTML page with the form in it. Also post the full path to your servlet (ex c:\tomcat\webapps\.....).
|
 |
 |
|
|
subject: Resource not found
|
|
|