Meaningless Drivel is fun!*
The moose likes Tomcat and the fly likes Tomcat error?? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Tomcat error??" Watch "Tomcat error??" New topic
Author

Tomcat error??

campos teixeira
Ranch Hand

Joined: May 23, 2004
Posts: 51
I am having an error in tomact and I cant see what the problem is?? It was working before fine. I want to teste but My jsp page cant find the Servlet class??

I am getting this error all the time!

HTTP Status 404 - /ServletLogin

description The requested resource (/ServletLogin) is not available.

Does anyone also had the same problem?? I have been looking in the web but can find anything?

I am working with eclipse and Tomcat! First the tomact index page doesnt
show but My change page does but doesnt call the servlet.

My jsp page is?


and My web.xml is:


Any help please?!

thanks
[ June 07, 2004: Message edited by: Mike Curwen ]
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16236
    
  21

You need a <servlet-mapping> to map the URL to an abstract servet name. You've got that.

You also need a <servlet> definition to map that abstract name to a servlet definition. Yours is incomplete - it doesn't give the class name of the servlet.



Customer surveys are for companies who didn't pay proper attention to begin with.
campos teixeira
Ranch Hand

Joined: May 23, 2004
Posts: 51
Hi Tim

I think you didnt look very well at my web.xml?? I already have my class and the url mapping?? SO what I am missing out that I cant see it??


web.xml?



SO where that Am I doing wrong even putting in the examples directory in tomcat it only calls the jsp page.
[ June 07, 2004: Message edited by: Mike Curwen ]
campos teixeira
Ranch Hand

Joined: May 23, 2004
Posts: 51
when you say


You mean my full path of the ServletLogin class right?? Which is in my package dbConnect right ?? SO I did

Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

fyi: My edit were for line length.
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

Your web.xml looks good.

what is the structure of your web app directory? (Where are your class files, etc)
what does your context declaration look like?
campos teixeira
Ranch Hand

Joined: May 23, 2004
Posts: 51
Thanks Mike!


But I goot it!! It looks like that the it was asking for the context name in the form action?? It is funny as it didnt ask for it before??

In my action form I had put :

<form action="/ServletLogin > and the jsp page wasnt finding the Servlet class but it did before and it could only now because I put the context name or the method request.getContextPath() in the action then it works very well?!

Does anyone knows why?? I am using Eclipse with Tomcat.

Why I cant call the servlet class directly from the jsp page??
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

well you are calling it "directly" from the JSP.

The change can occur from development environments, where you are the default context (an empty string), to where you are not the default context. The short answer is:

It is a best practice to always include request.getContextPath() in your form URLs (and other relative URLs)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Tomcat error??