This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Servlets and the fly likes request dispatcher Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "request dispatcher" Watch "request dispatcher" New topic
Author

request dispatcher

sitaram irrinki
Ranch Hand

Joined: Feb 16, 2005
Posts: 158
Using requestdispatcher.include(request,response) we can include the
content generated by another servlet/html in the response.
The included servlet makes use of this request/response object pair.

But what is the use of this request/response pair if we are including an Html page(may be we generally don't include an Html page from a servlet but in case if we do so).
Is this just the syntax that we have to follow or is there any reason for this.
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
Moving to our Servlets forum...


The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

When you include an HTML page, what you're really doing is forwarding or including the defaultServlet (or whatever it is, in your container, that serves up static content). That servlet has the same access to the request and response as any other.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
 
jQuery in Action, 2nd edition
 
subject: request dispatcher