• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Himai Minh

Few doubts

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Please let me know in detail :

1. requestDispatcher
2. sendRedirect
3. forward

It will be great if one can provide me difference between above three and which one is to be used preferably.

Regards,
R S
 
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
read the docs. there is no other better substitute.
 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Forward :

When a user asks for a resource, next page is rendered as a response.Just it is a way of displaying the page when a resource is asked by a user.
It is achieved using requestDispatcher.

RequestDispatcher rd = Requestdispacther.getRequestDispather(uri);
rd.forward(HttpServletRequest, HttpServletResponse);

Redirect :

When a user asks for a resouce, server sends a response, which is not the actual requested resource. It does by sending repsonse code of 302 and a URL of the requested resource.
The browser automatically makes a request with this URL and gets the resource.
Thus there is round trip operation between the client and the server. so it should be used in special purposes by using the methods
sendRedirect()...




Go through the documents for further understanding..

Thanks
Krishna Mohan.
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"R S B",
You have already been asked to change your display name here and here.

We're light on rules, but we take display names quite seriously. You can read the full report here, but basically we require your display name to be two words: your first name, a space, then your last name. Fictitious names and initials aren't allowed.

Please edit your profile and correct your display name, since accounts with invalid display names get deleted, often without warning.

thanks,
Dave
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"Rajat",

Originally posted by David O'Meara:
...basically we require your display name to be two words: your first name, a space, then your last name.



Sorry, but we need two words: your first and then last name, separated by a space
 
Get me the mayor's office! I need to tell her about this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic