• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Tomcat error??

 
campos teixeira
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 18098
50
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

 
campos teixeira
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
fyi: My edit were for line length.
 
Mike Curwen
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic