aspose file tools*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes comparing Request Dispatchers Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "comparing Request Dispatchers" Watch "comparing Request Dispatchers" New topic
Author

comparing Request Dispatchers

Yogesh Hingmire
Ranch Hand

Joined: Dec 06, 2005
Posts: 61
We know that a Request Dispatcher obtained from a ServletRequest can be used to fwd requests to a component relative to the current resource.

Can this RequestDispatcher(obtained from ServletRequest) be used to fwd requests to components in other /contexts. (My understanding is "NO")

Also, would be great if we compare the capabilities of Request Dispatchers obtained from ServletContext and ServletRequest.

Thanks,
Yogesh
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

Can this RequestDispatcher(obtained from ServletRequest) be used to fwd requests to components in other /contexts. (My understanding is "NO")

It actually can, if your container is configured to. For example, in Tomcat, you can set some Context as being crossContexts, making them accessible to other apps.

Also, would be great if we compare the capabilities of Request Dispatchers obtained from ServletContext and ServletRequest.

The difference between ServletRequest and ServletContext's getRequestDispatcher(java.lang.String) is that ServletRequest's method can take a relative path.


[My Blog]
All roads lead to JavaRanch
Yogesh Hingmire
Ranch Hand

Joined: Dec 06, 2005
Posts: 61
Thanks Satou,

So when i use a Request Dispatcher obtained from a Servlet Request to fwd requests to other contexts in the container, i would start with a "/" and this would be an absolute path.Is that correct ?

Yogesh.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: comparing Request Dispatchers