URL Rewriting In JSP & Advantages

greatcoder

greatcoder

@greatcoder-Zo4hpf Oct 26, 2024

Hello Experts,

I have heard a lot about URL rewriting. Can u plz tell me
1) How to implement URL rewriting in JSP
2)WHat are the advantages of URL rewriting?

Regards
GC

Replies

Welcome, guest

Join CrazyEngineers to reply, ask questions, and participate in conversations.

CrazyEngineers powered by Jatra Community Platform

  • Ankita Katdare

    Ankita Katdare

    @abrakadabra Apr 2, 2012

    #-Link-Snipped-# Good question indeed. I have no knowledge about the implementation part. However, I too have read quite a bit about it.

    URL rewriting can be termed as a way of supporting 'anonymous session tracking'.
    Meaning to say, the local URLs can be loaded with additional information by modifying/rewriting them. This extra information is usually limited to a unique session ID. I think it must be a tiresome task to rewrite the URLs.

    The real benefit, as they say, is "search engine optimization" or SEO for budding OR NEW websites. Substantially old websites do not want to indulge in this, because that might not reflect very well in their search engine rankings, because the spiders will have to be made known about your new page locations.

    Hence, URL rewriting will work only for the websites whose pages are not already listed on Google, Yahoo and the likes.

  • PraveenKumar Purushothaman

    PraveenKumar Purushothaman

    @praveenkumar-66Ze92 Apr 6, 2012

    IDs and Anonymous Session Tracking? New to that here... 😛

    Anyways, the main use is like what you said is SEO. Another thing is, it is better to remember URLs like facebook.com/crazyengineers other than having facebook.com/?page_id=10000000456788 right? That's another main use... 😀

  • Sahithi Pallavi

    Sahithi Pallavi

    @sahithi-oJZaYj Apr 6, 2012

    Good question and good answers.

    So what facebook,twitter profile page URLs' uses is URL rewriting, right?

    Now I want to know about implementation part. Anyone here can hint about it?

  • PraveenKumar Purushothaman

    PraveenKumar Purushothaman

    @praveenkumar-66Ze92 Apr 6, 2012

    SadaGood question and good answers.

    So what facebook,twitter profile page URLs' uses is URL rewriting, right?

    Now I want to know about implementation part. Anyone here can hint about it?

    Why are you going to that extent? Simple! Even our CrazyEngineers Forum uses URL Rewriting. There is no URL like #-Link-Snipped-#, but actually the URL is #-Link-Snipped-# (or something similar, purposely didn't reveal the original one). It can be done only by the server.

    In CE's case, it is the Apache Server and it uses mod_rewrite.
    In Windows, it would be IIS 7 or later, with the URL Rewrite Module installed.
    In case of JSP, it is web.xml, where you give the routes.
    In case of Rails, it is Rake Routes... 😁

  • sookie

    sookie

    @sookie-T06sFW Apr 9, 2012

    You can use "response.encodeURL(String url)" in JSP to apply URL rewriting.

    And regarding more info about "URL rewriting" read this article #-Link-Snipped-# . Good one!

  • PraveenKumar Purushothaman

    PraveenKumar Purushothaman

    @praveenkumar-66Ze92 Apr 9, 2012

    sookieYou can use "response.encodeURL(String url)" in JSP to apply URL rewriting.

    And regarding more info about "URL rewriting" read this article #-Link-Snipped-# . Good one!

    Buddy, response.encodeURL has lots of bugs, and it won't work if output has been buffered... 😔

  • ysr shk

    ysr shk

    @ysr-shk-8AjUTB Apr 23, 2012

    URL rewriting is sometimes used to hide the attribute values to be displayed in the address bar.
    Suppose I have 2 attributes,which I am sending from a html page.
    then after that page name that are added,if I had been use method GET.
    like, xyz.com/abc.html?fist_attribute=something&second_attribute=something.

    Sometimes in JSP it is not supported to use POST method so we has to use GET.
    And it is not secure that your user name or password to be displayed in URL,it's break the privacy of that user.
    So we have to encode that URL by rewriting it.

    You can use the method as told by #-Link-Snipped-#

    URL rewriting is same as DNS concept.
    In DNS,we automatically replace the Name to corresponding IP or vice-versa.