We have "extended JSP", but its not really true: we created a parent page,
hit it so it compiles, then use its compiled name for the extends, ex:
extends="jsp.mydir.myParent".  The parent itself has no meaningful output,
but we put in some code so that when it is hit from the url it will hit
its own methods and print some results (much like using main(String
args[]) when testing regular classes).

Be warned, however, that last time I tried this (with JRUN on WinNT) it
wouldn't extend "jsp" from other directories, the parent had to be in the
same directory as the child, so it actually looks like this:
extends="myParent".  There appears to be some bug in the way JRun converts
the package name to the directory structure where the compiled class is
located.

Lance Lavandowska
Software Engineer
http://www.AgDomain.Com

-----Original Message-----
From: Colin Wilson-Salt <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
Date: Friday, July 16, 1999 3:42 AM
Subject: Can a JSP extend another JSP? Many questions


>Hi.
>
>I'm writing some jsp files to be the V part of an MVC design.
>
>These jsp files all produce very similar looking output - they all
>produce single column tables with exactly the same layout.
>
>I would like to make all these classes extend a common base class, so
>that I can keep all the shared stuff, like setting the colour for the
>header row of the table etc. all in one place.
>
>We're given <%@ page extends="parentClass" %>, but if we want to make
>the parent class another jsp, is there a way?
>
>How do I specify in my parent jsp which package it will be a part of, so
>I know how to refer to it from the child class?
>
>How can I let the jsp compiler know that the parent class needs to be
>compiled first? javac won't be able to find the class file so will go
>looking for a .java file, and won't know anything about the .jsp.
>
>Is this all just too much to ask, and should I just write a helper class
>to do the formatting? I could instantiate it in the main page and store
>it in the session, so all the other classes use it for doing formatting
>stuff, leaving me with my formatting code in just one place.
>
>Also I'm including many of these different views in one big table. If I
>want to make each view a seperate class, I have to include them with
><jsp:include> rather than <%@ include " %>. From what I understand this
>is almost like making a whole new request on the web server. What is the
>overhead of this, if I'm going to be doing it 10 times in a single page?
>Perhaps we need a form of include which instantiates a new servlet/jsp
>without going through the web server?
>
>=========================================================================
==
>To unsubscribe, send email to [EMAIL PROTECTED] and include in the
body
>of the message "signoff JSP-INTEREST".  For general help, send email to
>[EMAIL PROTECTED] and include in the body of the message "help".
>

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JSP-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to