Yes!

I've had the same problems with JSP that Jason Hunter (Mr. Servlet) writes
about in his soapbox column at http://www.servlets.com In his article, he
recommends template processing as a reasonable alternative.  I've been
looking at Enhydra XMLC (which Jason also mentions) and found it to be too
big and slow to be practical.  XMLC actually UNDERSTANDS the HTML files,
building a DOM tree which is accessible from your servlet.  This is too
much runtime overhead to be practical.

The concept of template processing is to treat the HTML template like a
stream of data, replacing $vars with appropriate values.  The template
processor doesn't need to understand the structure of HTML... just do
replacements.

When it comes to a choice of template processors, Jason talks up WebMacro.
I tried it out and was disappointed; but it did give me some ideas.
WebMacro does it's own parsing with a mini-language.

Tcl has long been my preferred scripting language, and Jacl seems to have
been made for template processing.  I've been working on some basic
commands (such as page counters and includes) as well as the proper
organization of what I call "WELD" applications.  If TCL scripting is the
"glue" for legacy apps... Jacl holds web applications together even more
strongly (it's also an acronym for "Web Enabled Logic Documents" :-)

The WELDing package is part of the open souce servlet utilities project at
http://www.javafoundry.com/javapdf but won't be fully integrated until the
next release.  Source for WELD is available on request.  What it adds to
standard Jacl are the generic WELD commands and session-oriented
interpreters that read configuration files.

Here's a tiny WELD template that illustrates the concept using standard
Jacl commands:

<html>
<head><title>Commands</title></head>
<body>
<center><h3>[set curtime [clock format [clock seconds]]]</h3></center>
<h1>Commands</h1>
<ul>
<li>
[join [lsort [info commands]] <li>]
</ul>
<p align=right><font color=red>$curtime</font>
</body>
</html>

The beauty part of this is that the templates can be created with any HTML
composition tool, and the web page designer only needs to know a few
commands (which the Java programmer provides) and $variables.  As
illustrated above, these can be put anywhere in the HTML.

Although you can directly call Java from Jacl, I don't recommend this for
use in servlets.  My opinion is that the better approach is to write new
commands in Java and have these do communication with the back end.

My reasoning here is that we who love Tcl may prefer to minimize our Java
work - but this is contrary to the strategic direction of some employers.  
A better, more team-oriented approach is to show other programmers how
easy it is to add a command interface to their existing Java classes -
then call that command from WELD files.

        - Lee






=+=*=+=*=+=*=+=*=+=*=+=*=+=*=+=*=+=*=+=*=+=*=+=*=+=*=+=*=+=*=+=*=+= 
"You see, at just the right time, when we were still powerless,
   Christ died for the ungodly." - Romans 5:6

On Wed, 29 Mar 2000, Asim Jalis wrote:

> Has anyone used Jacl to write Java servlet code? How
> well does this work? Any experiences or pointers or URL
> references?
> 
> Asim
> 
> ----------------------------------------------------------------
> The TclJava mailing list is sponsored by Scriptics Corporation.
> To subscribe:    send mail to [EMAIL PROTECTED]  
>                  with the word SUBSCRIBE as the subject.
> To unsubscribe:  send mail to [EMAIL PROTECTED] 
>                  with the word UNSUBSCRIBE as the subject.
> To send to the list, send email to '[EMAIL PROTECTED]'. 
> An archive is available at http://www.mail-archive.com/tcljava@scriptics.com
> 
> 


----------------------------------------------------------------
The TclJava mailing list is sponsored by Scriptics Corporation.
To subscribe:    send mail to [EMAIL PROTECTED]  
                 with the word SUBSCRIBE as the subject.
To unsubscribe:  send mail to [EMAIL PROTECTED] 
                 with the word UNSUBSCRIBE as the subject.
To send to the list, send email to '[EMAIL PROTECTED]'. 
An archive is available at http://www.mail-archive.com/tcljava@scriptics.com

Reply via email to