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 forward() and include() methods Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "forward() and include() methods" Watch "forward() and include() methods" New topic
Author

forward() and include() methods

deepashree deval
Greenhorn

Joined: Oct 20, 2008
Posts: 12
Can anybody give me a real time scenario where can i use forward() method and in which situation i should go for the include()method for redirection
vipin joseph
Greenhorn

Joined: Feb 17, 2008
Posts: 4
Include method is used when we want to include some external files in our Servlet (eg: html, javascripts). If you want to show some advertisements in your sevlet code you can include the avertisement page as an image or html file.

We use forward method to navigate the request and response object to another resouce on the same server.
suppose we want to assign a jsp to display the contents we can navigate from the servlet to jsp using forward method. here servlet is reponsible for data processing and jsp is for display (MVC pattern follows this)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: forward() and include() methods
 
Similar Threads
Request Dispatcher.
Request Dispatcher
SCWCD exam: which methods should be known?
Request Dispatcher calling mode
calling html and jsp from Servlet