URL Encoding is a process of transforming user input to a form that is fit for travel across the network. It basically means stripping spaces and punctuation and replacing with escape characters. URL Decoding is the reverse process. To perform these operations, call java.net.URLEncoder.encode() and java.net.URLDecoder.decode().
Example: changing "Payment Done" into "Payment%20Done". The space character has been encoded to %20.
URL Rewriting is a technique for saving state or session information on the user's browser between page hits. Its a session management technique. The session information gets appended at the end of the URL, as an additional parameter. The HttpSession API, which is part of the Servlet API, sometimes uses URL Rewriting when cookies are unavailable. This is achieved through HttpServletResponse encodeURL(String url).
something like: www.someserver.com/paymentPage.jsp/confirm;jsessionid=j765adof765TVSc. The session information is added to the end of the url.