wood burning stoves 2.0*
The moose likes Servlets and the fly likes Status 404 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Status 404" Watch "Status 404" New topic
Author

Status 404

Deepan Ignatius
Ranch Hand

Joined: Mar 29, 2010
Posts: 41
Hi,

I have placed my compiled servlet code identical to this location "c:
\...\LApps\WEB-INF\classes\coreservlets\ShowBalalnce"
which in turn is
using another servlet class BankCustomer present in the same location.


While trying to access the servlet ShowBalance using this URL:
http://localhost:8181/LApps/coreservlets.ShowBalance?id=id001, I am
getting 404 error page stating that "/LApps/coreservlets.ShowBalance
is not available. "



PS: Inside the ShowBalance servlet, if the id is id001 then I am
forwarding the request to a JSP. So my expectation is that it should result in a jsp page
but it isnt.

Can anyone of you correct me?

Thanks in advance!
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

Did you add servlet mapping information to your WEB-INF/web.xml file? Classes are not made available automatically as this would be a security issue.
Roshan Ramesh
Greenhorn

Joined: Jul 12, 2010
Posts: 8
Ensure that you have proper mapping information for "coreservlets.ShowBalance" in WEB-INF/web.xml.

Without this, you tend to get that 4xx class of errors.
Deepan Ignatius
Ranch Hand

Joined: Mar 29, 2010
Posts: 41
David,

I dont have web.xml. I did this intentionally as I am not sure of how to pass a parameter using it.

How to add a web.xml entry for this?

ex:-

<servlet>
<servlet-name>hello</servlet-name>
<servlet-class>coreservlets.ShowBalance</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>hello</servlet-name>
<url-pattern>/hello</url-pattern>
</servlet-mapping>

Hwow to include a parameter[?id=id001] in this?
Deepan Ignatius
Ranch Hand

Joined: Mar 29, 2010
Posts: 41
I got it.

Thanks for your inputs.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

It's good to follow up with the answer to your question so that other people with the same problem can learn! Thanks!
Deepan Ignatius
Ranch Hand

Joined: Mar 29, 2010
Posts: 41
Ok. Using url like this "/hello?id=id001" has solved the problem.

Thanks.
Deepan Ignatius
Ranch Hand

Joined: Mar 29, 2010
Posts: 41
Snippet of my web.xml

<servlet>
<servlet-name>hello</servlet-name>
<servlet-class>coreservlets.ShowBalance</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>hello</servlet-name>
<url-pattern>/hello</url-pattern>
</servlet-mapping>

J2EE level - J2EE 5
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Status 404
 
Similar Threads
using XHTML & JSP in the same application
An exception occurred processing JSP page
not getting what this servlet is doing+MVC
Passing Parameters between the tabs in single JSP
web.xml tag problem