Reputation: 2076
The theory says that
A request dispatch happens on the server, while a redirect happens on
the client.
Aren't that the both methods used in the servlet? Then both should happen at server side. Right?
Or did i misunderstood what is client/server side?
Please give me clear explanation with some examples if you can.
Thank you.
Upvotes: 1
Views: 1064
Reputation: 68715
redirect is a signal that server sends to the client with the means of HTTP response header.
HTTP 302
code is used along with a location
header in the response from server. When client receives 302, it then uses URI specified by the Location header to fire a new request.
A request dispatch happens on the server, while a redirect happens on the client.
So redirection is initiated by the server but actual redirection happens on the client side, because client is responsible to send the new request.
Upvotes: 1
Reputation: 83
It works at client side because it uses the url bar of the browser to make another request. So, it can work inside and outside the server.
Upvotes: 0