This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js and have Paul Jensen on-line!
See this thread for details.
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

RequestDispather?  RSS feed

 
Malhar Me
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Can anybody tell me exactly when and which scenario we use request.getRequestDispatcher() and context.getRequestDispatcher() ?
I know their programming difference. I know the exact reason. Please help me on that.

Malhar
 
Shashank Rudra
Ranch Hand
Posts: 131
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When you need to forward a request from a servlet to another resource. You will use RequestDispatcher. It will not show any change in the URL in browser and user will not know of it. Now to get this dispatcher there are two ways
or
Depends what you prefer, both ways are ok. It may depend on the availability of the handle to each of them. Though they are almost equally available.

 
Malhar Me
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

you mean to say, I can use any method either request or context, it doen't matter.
right....
 
Shashank Rudra
Ranch Hand
Posts: 131
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes exactly.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!