my dog learned polymorphism
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes jsp calling a servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "jsp calling a servlet" Watch "jsp calling a servlet" New topic

jsp calling a servlet

Prasad Kharkar
Ranch Hand

Joined: Mar 07, 2010
Posts: 446

I am trying to call a servlet from a jsp but that is not working at all
I tried the following code

but when I try to go to another servlet other than ExamInitilizer
let us say,

if we write

I have not written any code in doGet and doPost method of both servlets other than simle println statements

second works fine but first does not work
all the spellings and paths are correct
what can be the problem

SCJP 6 [86%], OCPWCD [84%], OCEJPAD [83%]
If you find any post useful, click the "plus one" sign on the right
Paul Clapham

Joined: Oct 14, 2005
Posts: 19973

Prasad Kharkar wrote:all the spellings and paths are correct

I doubt that. If I had been designing the system that servlet would not have been called "ExamInitilizer" because that isn't correct spelling. I would have called it "ExamInitializer". Maybe -- as you say -- all the spellings are correct. In which case you too should use the correct spellings.

And by the way you are not trying to "call" a servlet with that code. That is vague and unhelpful terminology. You are trying to forward to a servlet. Please use the standard terminology, it makes it much easier if we don't have to guess at the meaning of vague and undefined words like "call".
Vijitha Kumara

Joined: Mar 24, 2008
Posts: 3902

Have you checked your mappings in web.xml for the offending servlet?

[How to ask questions] [Twitter]
I agree. Here's the link:
subject: jsp calling a servlet
jQuery in Action, 3rd edition