Because the rules for making this determination can differ from those used to decide whether to encode a normal link, this method is separated from the encodeURL method.
Because the rules for making this determination can differ from those used to decide whether to encode a normal link, this method is separated from the encodeURL method.
Mark E Hansen wrote: When you which to pass a URL to sendRedirect, you need to use the encodeRedirectURL method.
Sony Agrawal wrote:Ok .. so can you give me an example for each method about when to use?
You have already said that when sendRedirect is needed we should use encodeRedirectURl.
for encodeURL --???
Any other case. How about a forward
Mark E Hansen wrote:
Any other case. How about a forward, as in:
encodeURL is used with RequestDispatcher when you want to keep track of session so the jsessionid is added to your url.
Ben Souther wrote:
Mark E Hansen wrote:
Any other case. How about a forward, as in:
The encodeURL method embeds the session ID into the URL so it would be pointless to use it for a server side forward.
The encodeURL method is useful if you are building up a hyperlink href attribute or an image src attribute to be written directly to the browser.