This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds and have James Denton on-line!
See this thread for details.
Win a copy of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

jsp-servlet-jsp  RSS feed

 
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??
 
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!
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!