aspose file tools*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Doubt regarding forward method in request dispatcher Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Doubt regarding forward method in request dispatcher" Watch "Doubt regarding forward method in request dispatcher" New topic
Author

Doubt regarding forward method in request dispatcher

Vinay Kumar chowdary
Greenhorn

Joined: Nov 24, 2006
Posts: 20
Hi all,
I was going through Mikalai Zaikin notes and came across the following lines about forward method in request dipatcher..can anyone please explain???

"The path elements of the request object exposed to the target servlet must reflect the path used to
obtain the RequestDispatcher. The only exception to this is if the RequestDispatcher was obtained
via the getNamedDispatcher method. In this case, the path elements of the request object must reflect
those of the original request. Before the forward method of the RequestDispatcher interface returns,
the response content MUST be sent and committed, and closed by the servlet container. "
Tha�s Manfrim Firmino
Ranch Hand

Joined: Apr 12, 2004
Posts: 48
Here the author is talking about the ServletContext and RequestDispatcher methods.
**The path elements of the request object exposed to the target servlet must reflect the path used to
obtain the RequestDispatcher.
--> public RequestDispatcher getRequestDispatcher(java.lang.String path) - path is the location for a resource. The pathname must begin with a "/" and is interpreted as relative to the current context root

** The only exception to this is if the RequestDispatcher was obtained
via the getNamedDispatcher method. In this case, the path elements of the request object must reflect
those of the original request.
--> public RequestDispatcher getNamedDispatcher(java.lang.String name) - name is a servlet or JSP name given via server administration or via a web application deployment descriptor
As you see , since the path is not specified, it must reflect those of the original request.

**Before the forward method of the RequestDispatcher interface returns,
the response content MUST be sent and committed, and closed by the servlet container.
-->After you get a dispatcher, considering that you are going to make a call to forward, after you forward, the resource is going
send a response and commit it in the end, and then returns.

Is it clear now?


Tha�s M. K. M. Firmino
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Doubt regarding forward method in request dispatcher