This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
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 REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "forward() and include() methods" Watch "forward() and include() methods" New topic

forward() and include() methods

deepashree deval

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

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:
subject: forward() and include() methods
It's not a secret anymore!