This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Soft Skills and have John Sonmez on-line!
See this thread for details.
The moose likes Servlets and the fly likes Calling a target servlet from a JSP include servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Calling a target servlet from a JSP include servlet" Watch "Calling a target servlet from a JSP include servlet" New topic
Author

Calling a target servlet from a JSP include servlet

Anoop Thakur
Greenhorn

Joined: Jul 06, 2005
Posts: 1
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
Marshal

Joined: Mar 22, 2005
Posts: 42908
    
  69
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Calling a target servlet from a JSP include servlet