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 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
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: 41106
    
  45
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.


Ping & DNS - my free Android networking tools app
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Calling a target servlet from a JSP include servlet
 
Similar Threads
passing large data to a servlet
When to use servlet include
Action as a tile
how to get objects from an included
Struts: includeactive in jsp