Eelco Hillenius wrote:
The context path should automatically be resolved for you. Could you
give just using relative paths a try?

Thanks for the reply, but I'm not sure how I could do that. The URLs are *created* by the Javascript, based upon the context path. I can't use relative paths such as

   href = "../../images/myImg.gif"

because the URL for a sinlge page might look like either

    http://localhost:8080/tixx/app/?wicket:interface=:16::::
    http://localhost:8080/tixx/app/main/SelectSeats/event/815

depending upon how I got there. The browser would not get the same image location from the href above and each of these relative paths.

So I use something like

    var contextPath = "<filled in from Java";
    myImg.src = contextPath + "/images/myImg.png";

and in the HTML I have a an earlier script that sets contextPath to "", so that it works in preview mode as well as live mode.

I've been doing this this way for years with Wicket and it's never been an issue, but I may well have always been missing a better way.

I you want Javascript to construct URLs for static resources or bookmarkable pages in an application where the contextPath is not fixed, how do you do it?

  -- Scott

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to