| Author |
requested resource not found error
|
naved momin
Ranch Hand
Joined: Jul 03, 2011
Posts: 675
|
|
i was making my first web app and fall into this problem , the problem is when i click on a submit button on a html form (welcome page ) it directs me to a http 404 not found error (requested resource not found error)
my web.xml file
my actual servlet class
my welcome page
can any one help me please......???
|
The Only way to learn is ...........do!
Visit my blog http://inaved-momin.blogspot.com/
|
 |
Matthew Brown
Bartender
Joined: Apr 06, 2010
Posts: 3795
|
|
|
You haven't mapped your servlet to any URLs. You need a <servlet-mapping> tag in your web.xml.
|
 |
naved momin
Ranch Hand
Joined: Jul 03, 2011
Posts: 675
|
|
Matthew Brown wrote:You haven't mapped your servlet to any URLs. You need a <servlet-mapping> tag in your web.xml.
still same problem
now what ?
|
 |
Matthew Brown
Bartender
Joined: Apr 06, 2010
Posts: 3795
|
|
naved momin wrote:still same problem
now what ?
And is your form posting to the URL that you've just mapped your servlet to?
|
 |
naved momin
Ranch Hand
Joined: Jul 03, 2011
Posts: 675
|
|
Matthew Brown wrote:
naved momin wrote:still same problem
now what ?
And is your form posting to the URL that you've just mapped your servlet to?
changed the form action to this
still the same 404 error ? now what else can we do ?
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56224
|
|
|
You should be prefixing the action url with the context path of the web app.
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
naved momin
Ranch Hand
Joined: Jul 03, 2011
Posts: 675
|
|
Bear Bibeault wrote:You should be prefixing the action url with the context path of the web app.
you mean to say like this
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56224
|
|
|
|
 |
Victor M. Pereira
Ranch Hand
Joined: Mar 02, 2012
Posts: 50
|
|
I can't believe no one has pointed this, but haven't you seen that your <servlet-class> in your DD ends with .Demo instead of .java
naved nomin wrote:
|
regards,
Victor M. Pereira
|
 |
Prasad Krishnegowda
Ranch Hand
Joined: Apr 25, 2010
Posts: 503
|
|
|
servlet class should never end with .java or any extension, just the fully qualified name of servlet should be given there..
|
Regards, Prasad
SCJP 5 (93%)
|
 |
Victor M. Pereira
Ranch Hand
Joined: Mar 02, 2012
Posts: 50
|
|
|
sorry, I forgot that part!
|
 |
sridhar sivaraman
Greenhorn
Joined: Mar 02, 2012
Posts: 13
|
|
when using your url pattern in the <form> tag, just omit the /
so, that your code will be,
<form action="demo" .........>
try and post your output
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56224
|
|
sridhar sivaraman wrote:when using your url pattern in the <form> tag, just omit the /
so, that your code will be,
<form action="demo" .........>
try and post your output
No. No. No. No. No. That's very bad advice.
Always start the action URL with the context path. Otherwise it's page-relative and fragile and will easily break with the smallest change in the web application.
Follow best practices. They exists because they've been proven to work.
|
 |
 |
|
|
subject: requested resource not found error
|
|
|