-----------------------------
Please read the FAQ!
<http://java.apache.org/faq/>
-----------------------------


Hi,
On Wed, 8 Sep 1999, Craig R. McClanahan wrote:
CRM| > We have written a Java servlet which reads specific tags from
CRM| > a HTML (We call it VHTML) file and replaces them with HTML code
CRM| > built using details extracted from an Oracle database.
CRM| > We have also written the same pages using JSP (0.91 for GNUJSP)
CRM| > and are able to display the completed page using both formats.
CRM| > Using a browser we appear to get a better response from the JSP
CRM| > than the VHTML pages.
CRM| 
CRM| Are you doing the tag replacement parsing each time that the page is
CRM| requested?  If so, this is not at all surprising, because most
CRM| JSP implementations generate (and compile) a Java servlet to create the
CRM| page.  The servlet just dumps the template text out of an array, and
CRM| sticks in the variable parts where you originally had your tags, so it
CRM| does not have to parse anything.

Yes and this is memory consuming. In fact, usually the JSP-Compilers
generate a code which read the file and copy it to the output until the
first tag, executes this area, skips it in the input-file and so on. So
the generated servlet actually isn't very large (if the text would be in
an array). BUT - I don't like JSP generated generated servlets since you
probably hog the JVM with many loaded classes if you've many *.jsp-files 
(personal view). And the turnaround-times are long since the generated
class has to be compiled first ..

So, in your case, I'd prefer the VHTML-stuff, but it should be done
more efficiently if it is slower than JSP. 
Did you have a look at the current JSSI ? It is meant to
replace <servlet></servlet>-Tags with the output of sub-servlet calls, but
it is done in a fashion that allows you to define additional 
'Tag-Handlers' which generate the output that replaces a Tag or an
area (Like your servlet).
Since the driver servlet 'SSI' parses the page once and caches the
relevant information (where the tags start/end), it is very fast in the
second run since it does not have to parse anything. This is then
comparable to JSP (with ONE servlet).

A Tag-Handler is an Interface your handler class has to implement; then
you have to register it for a specific tag that it should handle.
This isn't documented in the user documentation of JSSI since this is an
implementation issue, but have a look at the JavaDoc and the
org.apache.servlet.ssi.ExampleTagHandler which shows how it works.

ciao,
  -hen
---
Henner Zeller                                 [EMAIL PROTECTED]
 PGP pub key [77F75B39]: finger [EMAIL PROTECTED] 

 If Microsoft is the answer, it must have been a VERY silly question.



--
--------------------------------------------------------------
Please read the FAQ! <http://java.apache.org/faq/>
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Archives and Other:  <http://java.apache.org/main/mail.html>
Problems?:           [EMAIL PROTECTED]

Reply via email to