Kindly tell me whether the Model 2 Architecture is the same as the
Model-View-Controller Architecture?
If no, then what is the Model 2 Architecture?
Regards
Sunil Roy
----- Original Message -----
From: "Hans Bergsten" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, March 09, 2001 12:49 AM
Subject: Re: [TIP] JSP Model 2 Architecture and DreamWeaver is a pain.
> 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).
> >
> > I found that the JSPs are wrong are wrong after the controller servlet
> > is invoked. By the first time the controller servlet is invoked
> > ("/servlet/ControllerServlet") then the request URI has changed and
> > the original relative URI "images/dogfood.gif" is been interpreted
> > wrong. The browser thinks it should load "/servlet/images/dogfood.gif"
> > which is nonsense of course. So I had to PAINFULLY do something
> > like this:
> >
> > <body onLoad="MM_PreLoad( '<%= request.getContextPath()
%>/images/dogfood.gif") .... >
> >
> > for all of the MM stuff and every single JavaScript invocation.
> > So I said f**k it. And wrote a custom action tag to help make thing
easier
> > see below
> >
> > <body onLoad="MM_PreLoad( '<app:homePath/>/images/dogfood.gif")
.... >
> >
> > It is a little easier. But it is a f***ing pain, man, cleaning up after
DreamWeaver,
> > because sometimes there are a dozen or more rollover gifs and other
DHTML.
> > but this is not MM fault, but gravy real gravy. I haven't got UltraDev
here I dunno
> > if it fairs any better.
> >
> > If any body got a better solution to this problem I'd be interested hear
of it.
> > This is the __BAD__ side of Model 2 MVC architecture, for real!
> > [...]
>
> 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]
> Gefion Software http://www.gefionsoftware.com
> Author of JavaServer Pages (O'Reilly), http://TheJSPBook.com
>
>
===========================================================================
> 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
===========================================================================
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