I think that both returns a string (url encoded with jsessionid, if required).
Returned value from any can be used with sendRedirect method.
then what's the major difference ?
Anindya Roy wrote:
encodeURL() is used for all URLs in a servlet's output. It helps session ids to be encoded with the URL.
encodeRedirectURL() is used with response.sendRedirect only. It is also used for encoding session ids with URL but only while redirecting.