File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes Doubt on calling Servlet from JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Doubt on calling Servlet from JSP" Watch "Doubt on calling Servlet from JSP" New topic
Author

Doubt on calling Servlet from JSP

dhwani mathur
Ranch Hand

Joined: May 08, 2007
Posts: 621
hi all!!!

i am trying to call a servlet from a JSP....
sorry for such a long post
firstly

i have created a html file as below from which i am
calling JSP.....
trial.html



secondly i have created JSP from which i am calling
a servlet....which is saved in WEB-INF/classes folder
code for Testing.jsp is below




i am calling servlet named test in the
response.sendRedirect() method

here is code for test servlet



changes appropriate to web.xml file have been made
then also i am getting
HTTP STATUS -500
nullpointerException.............


i am trying a lot on it i dont know where i am going wrong


can anyone please help me onto
what is wrong with above code
or any help to solve my problem


it will be of great great help


thanks in advance...............

Dhwani:>Swimmers never weep.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

If you're getting a NullPointerException, you need to take a look at the server logs to find out where the exception is being thrown.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
dhwani mathur
Ranch Hand

Joined: May 08, 2007
Posts: 621
Hi thr

Thanks for your reply but since i am a beginner
i dont have that much idea onto where
to look for Exceptions please can you ellaborate
and explain the above concept so that i can track
where i am actualy going wrong...........it will
be kinda of you.


Thanks in advance

Dhwani:>Its always too soon to quit.
winay Kumar
Ranch Hand

Joined: Aug 13, 2007
Posts: 34
Hi,

which web server you are using? if you are using tomcat then you can find all server messages in stdout.txt file which inside tomcat/logs/stdout.txt


Winay Kumar<br />SCJP 5.0
dhwani mathur
Ranch Hand

Joined: May 08, 2007
Posts: 621
Hi thr

i am using Tomcat server anyways thansk a lot
my problem is solved but not completly
still i am left with some doubts
actualy first i call html from which i am
calling jsp later i am calling servlet
from jsp using
response.sendredirect() method but
i have put some more coding on my jsp
that i am not getting in my output
i just get the output from my servlet

i mean to say how can i pass my control from
servlet back to jsp so that
i can get output from furthur below jsp code.
i have tried methods like getcontextpath("testing.jsp")
from my servlet but i dont know if
i am in right direction or not

any help on above will be realy great
thanks in advance

Dhwani:>Its always too soon to quit.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

I'm not sure what you're trying to do exactly.
Can you post the relevant parts of your code?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Doubt on calling Servlet from JSP
 
Similar Threads
Calling JNDI from JSP
Login thing
J2EE and Servlets
Doubt on calling java class in Servlet
Doubt on Servlet having database connection?