Re: Finding absolute url in jsp page

Discussion in 'Java' started by Roedy Green, Mar 14, 2010.

  1. Roedy Green

    Roedy Green Guest

    On 13 Mar 2010 21:24:27 GMT, "Ken T." <> wrote, quoted
    or indirectly quoted someone who said :

    >The problem being that I want the absolute URL calculated based on where
    >the JSP page is.


    If it depends on where you are, you want a relative URL, not an
    absolute one.


    You can convert back and forth by comparing the absolute (or webroot
    relative) URL of source and target. You see how much they have in
    common. That much can be stripped off and replaced by ../ for each /
    in the stripped source.

    You can see some code to do this sort of thing at:

    https://wush.net/websvn/mindprod/fi...prod&path=/com/mindprod/htmlmacros/Tools.java
    --
    Roedy Green Canadian Mind Products
    http://mindprod.com

    Responsible Development is the style of development I aspire to now. It can be summarized by answering the question, “How would I develop if it were my money?” I’m amazed how many theoretical arguments evaporate when faced with this question.
    ~ Kent Beck (born: 1961 age: 49) , evangelist for extreme programming.
     
    Roedy Green, Mar 14, 2010
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. wl
    Replies:
    1
    Views:
    4,453
  2. Ashraf Fouad
    Replies:
    0
    Views:
    1,043
    Ashraf Fouad
    Aug 23, 2004
  3. =?Utf-8?B?UGF1bCBCb25mYW50aQ==?=

    Response.Redirect() converts relative URL to absolute URL

    =?Utf-8?B?UGF1bCBCb25mYW50aQ==?=, Apr 24, 2006, in forum: ASP .Net
    Replies:
    2
    Views:
    6,228
    bruce barker \(sqlwork.com\)
    Apr 25, 2006
  4. Rudi Ahlers
    Replies:
    11
    Views:
    835
    Aaron Bertrand [MVP]
    Apr 11, 2004
  5. John Nagle

    Relative URL to an absolute URL?

    John Nagle, Feb 26, 2008, in forum: Javascript
    Replies:
    3
    Views:
    236
    John Nagle
    Feb 26, 2008
Loading...

Share This Page