Difference Betwixt Url-Rewriting Url-Encoding Inward Servlet Jsp
URL-rewriting vs URL-encoding inward Servlet JSP
Main difference betwixt URL-rewriting together with URL-encoding is that URL-rewriting is a technique to hold user session if cookies are non enabled on client browser or browser doesn't back upwardly cookie spell URL-encoding is a agency to exceed string to server containing exceptional characters yesteryear converting exceptional characters similar infinite into to a greater extent than or less other characters similar + . people frequently confuse betwixt URL encoding together with URL rewriting because of in that location names which sounds quite similar for novel guys simply functionality wise they are totally dissimilar to each other, Also servlet encodeURL() method adds to a greater extent than confusion because its sounds similar its used for URL Encoding simply indeed used for URL Rewriting. This is besides a rattling pop servlet together with JSP interview questions , I convey besides shared to a greater extent than or less to a greater extent than questions on my posts 10 Servlet Interview questions answers together with 10 JSP interview questions together with answers for Java programmer.
Difference betwixt URL Rewriting together with URL Encoding inward JSP Servlet
You frequently involve to encode URL earlier sending it to server together with involve to rewrite URL amongst session id inward guild to hold session where cookie is non present. hither are to a greater extent than or less to a greater extent than differences betwixt URL-rewriting together with URL encoding inward Servlet JSP
1) java.servlet.http.HttpServletResponse methods encodeURL(String url) together with encodeRedirectURL(String URL) is used to encode SesssionID on URL to back upwardly URL-rewriting. don't confuse amongst refer encodeURL() because it doesn't produce URL encoding instead it embeds sessionID inward url if necessary. logic to include sessionID is inward method itself together with it doesn't embed sessionID if browser supports cookies or session maintenance is non required. In guild to implement a robust session tracking all URL from Servlet together with JSP should convey session id embedded on it.
In guild to implement URL-rewriting inward JSP you lot tin terminate utilization utilise JSTL heart together with mortal tag all URL passed to it volition automatically hold out URL-rewriting if browser doesn't back upwardly cookies.
While java.net.URLEncoder.encode() together with java.net.URLDecoder.decode()is used to perform URL Encoding together with decoding which supervene upon exceptional graphic symbol from String to to a greater extent than or less other character. This method uses default encoding of arrangement together with besides deprecated instead of this you lot tin terminate utilization java.net.URLEncoder.encode(String URL, String encoding) which allows you lot to specify encoding. equally per W3C UTF-8 encoding should hold out used to encode URL inward spider web application.
2) In URL rewriting session id is appended to URL together with inward representative of URL-encoding exceptional graphic symbol replaced yesteryear to a greater extent than or less other character.
That's all on difference betwixt URL-rewriting together with URL-encoding, allow me know if you lot come upwardly across to a greater extent than or less to a greater extent than differences betwixt these URL Encoding vs URL-rewriting inward Servlet together with JSP.
Further Learning
Difference betwixt Comparator together with Comparable inward Java
0 Response to "Difference Betwixt Url-Rewriting Url-Encoding Inward Servlet Jsp"
Post a Comment