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!
BTW: Here's my very simple custom action tag ``<app:homePath/>''
public class ProjectHomePathTag extends TagSupport
{
/**
* Default constructor for as reqd by JavaBeans spec.
*/
public ProjectHomePathTag()
{
super();
}
/**
* Simply prints the context path and is functionally equivalent
* to the JSP scriplet <code><% request.getContextPath() %></code>
*/
public int doEndTag()
{
try {
HttpServletRequest request = (HttpServletRequest)pageContext.getRequest();
pageContext.getOut().print( request.getContextPath()+"/special" );
}
catch (IOException ignored) {
// System.err.println( "EmisHomeTag.doEndTag() excpt:"+ignored.getMessage() );
// ignored.printStackTrace( System.err );
}
return EVAL_PAGE;
}
}
// fini
--
Peter Pilgrim
G.O.A.T
"the Greatest Of All Time"
--
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