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


JavaRanch » Java Forums » Java » Servlets
Bookmark "Redirecting to 3 different pages" Watch "Redirecting to 3 different pages" New topic
Author

Redirecting to 3 different pages

Shreya Menon
Ranch Hand

Joined: Jul 31, 2001
Posts: 285
Hi all,
My aim is to write a servlet which pops up a jsp page( first.jsp) in the beginning. Since my client is using Apache JServ, we are using JSDK2.0 and since using sendRedirect method. In the servlet after displaying the first.jsp I am continuing with my other procedure calls, that is doing a JDBC stored procedure call. Then depending upon the result of the Stored Procedure, if it is yes, I have to redirect to another page(Sucess.jsp ) and if failure to a second one(fail.jsp)
I tried using sendredirect again, but the effort is in vain.
Can anyone help me please.
This is an urgent requirement
Thanks,
Maya
vivek sivakumar
Ranch Hand

Joined: Aug 09, 2001
Posts: 187
hi maya,
kindly visit my post 2 Clarifications and see if u could suggest me some useful tips on that!!!
thanks in advance.


SCJP, SCWD <br />A farmer learns more from a bad harvest than a good one.
d frazier
Greenhorn

Joined: Aug 07, 2001
Posts: 9
You might try this not so pretty, but effective method...
load (first page - Welcome.html)
then initiate your calls to database (from button click, javascript timer, etc.), forward to a "hidden jsp" that displays nothing but database stuff and sets vars
then pass to handler, evaluate vars and re-direct to the possible output.
Remember that once the headers are written, you'll be limited with the methods that you can use for a re-direct.
Shreya Menon
Ranch Hand

Joined: Jul 31, 2001
Posts: 285
Hi Frazier,
Thanks for the rsponse.
Do you have any sample code for sending to a hidden jsp ?
If so can you send it to me at google_n@hotmail.com ?
Thanks,
Maya
Shreya Menon
Ranch Hand

Joined: Jul 31, 2001
Posts: 285
Hi Frazier,
Thanks for the suggestion to redirect to a hidden jsp.
I tried redirecting to a secong jsp and did the coding so that the second jsp calls the database validation servlet. After the validation this servlet easily calls the success and fail pages.
Thanks a lot
Maya
verduka fox
Ranch Hand

Joined: Jan 18, 2001
Posts: 178
Hello --
I know this post is somewhat old, but I think it applies to my situation. Please post the sample code for forwarding to a hidden jsp.
Also, what does:
"Remember that once the headers are written, you'll be limited with the methods that you can use for a re-direct."
mean? Please explain.
Thanks in advance!
v
 
wood burning stoves
 
subject: Redirecting to 3 different pages