Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Calling a target servlet from a JSP include servlet

 
Anoop Thakur
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok here is the scenario, i have a servlet that is called from a JSP by using a jsp:include, by this time half of the parent JSP is rendered.Now from this servlet i need to call another servlet which should direct me to another page that loads afresh and is not just included in the parent JSP.
I have tried requestDispatcher.forward , include, response.sendRedirect but i am still unable to achieve the desired result. Please help.
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Once you have started writing the response -as would be the case if you're in a JSP- you can't use forward and redirect any more. Either write some JavaScript into the response that redirects to the page you really wanted to go to, or -much better- change the logic to first determine which page should be displayed, and then forward to that.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic