"G*d dammit!" screamed Cartman as he fell off off bike again.

I have the very book sitting to left of my computer. I read the section of
"How URLs Are Interpreted?" chapter 12 Bits and Pieces paginas 265-267
and I thought that the best the best can get and  oh well.
I should've kept looking though !
--
Peter Pilgrim
G.O.A.T
                    "the Greatest Of All Time"


---------------------------------------- Message History 
----------------------------------------


From: Hans Bergsten <[EMAIL PROTECTED]>@java.sun.com> on 08/03/2001 11:19 PST
--<CUT>--

Peter Pilgrim wrote:
>
> I have been using JSP in the Model 2 architecture with a special
>  controller servlet. I have been using DreamWeaver V3.0 to
> design the pages and of course DW 3.0 conveniently writes out
> a lot of the JavaScript for you.
>
>      <body onLoad="MM_PreLoad( 'images/dogfood.gif") .... >
>
> So I took the raw HTML/JavaScript and insert it into a proper JSP,
> because DW3.0 does not support JSP (UltraDev does but I haven't got it).
>
--<CUT>--

I describe a solution to this problem in my book (Chapter 14): create a URL
mapping for your controller servlet so that you can use a URL to invoke it
"at the same" level in the URI structure as your JSP pages.

Say you have a JSP page at the top level of your URI structure ("foo.jsp") and
it contains a relative URI to an image, "images/dogfood.gif". As you have
discovered, if you invoke the controller with "/servlet/ControllerServlet",
the browser will interpret the relative image path as relative to "/servlet",
and that's not what you want. But if you create a URL mapping for the servlet
so you can invoke it with "/myController", the relative path in the JSP page
will be interpreted relative to "/" instead, and you get the behavior you're
after.

For more about this, read my JavaServer Pages book:

  <http://TheJSPBook.com/>

Hans
--
Hans Bergsten           [EMAIL PROTECTED]
--<CUT>--



--

This e-mail may contain confidential and/or privileged information. If you are not the 
intended recipient (or have received this e-mail in error) please notify the sender 
immediately and destroy this e-mail. Any unauthorised copying, disclosure or 
distribution of the material in this e-mail is strictly forbidden.

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to