Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

jsp-servlet-jsp

 
Joe Harry
Ranch Hand
Posts: 10128
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Guys,

I have a small requirement in my project. It is like this, I have a submit.jsp page which has a submit button and when the submit button is clicked, it calls a servlet and this servlet has some insert statements for the database and once this servlet runs to completion, I have to be redirected to the original submit.jsp that called it. Right now I'm doing it this way, map the file in the web.xml and once the servlet is fully run redirect it back to the submit.jsp that called it. I'm even checking the request path to make sure that only for requests from the submit.jsp, the redirect is happening.

I just want to know if there is a better way to do it other than this. I don't want to use javascript. Please help me guys!
 
Joe Harry
Ranch Hand
Posts: 10128
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Any idea guys?
 
Joe Harry
Ranch Hand
Posts: 10128
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Any thoughts for my post above??
 
Rancy Chadha
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jothi,

Let me frame out first from what I have understood from your post, you have a submit.jsp page on which when the submit button is pressed it goes to a servlet which does your db operations and after the operations are completed and servlet's job is done you want the control to come back to your original JSP. Is that correct? If this is what you want then i would have tried doing it this way:
Instead of redirecting the control to the servlet for db I would have used RequestDispatcher.include() method. In which case after the operations in servlet are done the control will come back to the original jsp.
Unsure if this is right solution or not. In case I am wrong or I have missed out something let me know.

Thanks
-Rancy
 
Joe Harry
Ranch Hand
Posts: 10128
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, this also would be a good solution. Maybe I'll try this as well!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic