Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

servlet not loading

 
Sivaraman Lakshmanan
Ranch Hand
Posts: 231
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hai all,
I am developing a web page which uses servlets and JSP. I am using Tomcat server. when I load all my JSP pages are working fine but when i call a servlet i get a error saying that the page u r requesting is unavailable.
How to solve this problem.
I have given all details in web.xml file also.
siva.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13064
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the syntax you are using for calling the servlet?
If you are using "../servlet/myservlet" than it sounds like the ever-popular "invoker" servlet problem.
Bill
 
Sivaraman Lakshmanan
Ranch Hand
Posts: 231
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes I am using the same to invoke the servlet. Then what is the soln for the problem
siva
 
Mike Curwen
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You say : I have given all details in web.xml file also.

What are those details? Does this mean you've supplied a <servlet>, <servlet-mapping> couplet for each servlet you're deploying?
 
Sivaraman Lakshmanan
Ranch Hand
Posts: 231
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes, I have given servlet-name,servlet-class,servlet-mapping etc in the web.xml file.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13064
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The "invoker" servlet is a convenience thing that (In my opinion) is a disaster. You can read about it in the ../conf/web.xml file.
You should not use the invoker, instead, use web.xml to create a servlet mapping from a URL to your servlet name.
Bill
 
Mike Curwen
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sivaraman,

If you've got the proper mappings, then you shouldn't be putting /servlet into the call to the servlet.

If it's there, take it out.

You don't tell us "how" you call your servlets, so I can only assume you're doing something like:

form action="/servlet/url-mapping"

take out the /servlet part
 
Sarath Mohan
Ranch Hand
Posts: 213
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I still have the problem....
Could you please give me the code in web.xml and form action tag for a simple HelloServelt
 
Mike Curwen
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here's a start ServletInvoker FAQ

Read 'The Middling Tale' for the mapping info.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic