Hi,

Besides the fact I consider templates as one of the best means to obtain
html (or any other type of) output in java web applications,
I believe also all programming languages are artificial.

Templates however tend to be both simple and powerfull. How much a
specific template engine achieve these goals is another issue.

Simple mean they look similar to other "languages" web designers
are confident with, powerfull means that you can do with simple
and clear constructs tasks that would look pretty confusing in Java,
embeded or not in JSP..

For example, a template engine might have a "ShowDate" tag to be
used as here, that looks very similar with all HTML tags - it is just
a new tag with a set of documented attributes. Dont care it is not
standard HTML since the output returned to the browser is:

<ShowDate
     ObjectPath="Session.Employer.BirthDate"
     Format="YYYY-MMMMM-DD"
     NullValue="not available"
>

This tag is much easier to understand and use for both
designers and programmers, and, believe me or not, can be even faster than
the following "natural" Java:

...
    PrintWriter out = request.getPrintWriter();
    HttpSession hs  = request.getSession(true);
    ...
    try {
      EmployerClass emp = (EmployerClass) hs.getValue("Employer");
      Locale userLang = (Locale) hs.getValue("LanguagePrefference");
      Date bd =  emp.getBirthDate();
      SimpleDateFormat sdf =
             new SimpleDateFormat("YYYY-MMMMM-DD", userLang);
      out.println(sdf.format(bd));
    } catch (Exception e) {
      out.println("not available");
    }
...

Using templates should be trivial to change the position in page where the
employer's birthdate is printed, how is printed, or to print it in many other
pages that didnt showed that information at all.

Market has also its own opinion - look at the success of ColdFusion
 wich is heavily based on non-standard,  nor java or html, proprietary
language templates. Only because it makes web site creation easier.

On Mon, 2 Aug 1999, Jain, Hursh wrote:
> Template engines would be more relevant if we had several sets of
> tempalates (different UI's) and
> the application designer could choose the template set dynamically
> (or swap them at compile
>  time).
Since (some of) them  dynamically choose the templates even at run-time,
without touching the classes, they should be relevant.

> But really, how many times do you want to change the entire
> look and feel of your web site ?
(** malicious insertion: when you worked so much to achieve its actual
    look&feel ? ;-)

I don't know how many times, often is hard to predict that at
development time.
That is why I preffer templates, give me confidence I'll easily
change and control application's look, feel *and* content and *even*
add new pages in my web applications how often my customers or boss will
want me to.
Or sell many, different looking web sites, with the same
compiled classes (same java source), to more than one customer.

Best regards
Cezar
PS: Sorry if this message was biased too.. but /usr/games/fortune said:

Excess on occasion is exhilarating.  It prevents moderation from
acquiring the deadening effect of a habit.
                -- W. Somerset Maugham


>         >Using a template engine such as WebMacro is in my (very clearly
> biased)
>         >opinion a much better solution, since the model/view/controller
> design
>         >is actually architecturally enforced.
>
>         No, it's not better ! Template engines in general make no sense for
> Web based apps, are difficult
>         to maintain and need a template scripting language in any case
> (which has a different
>         syntax than java)
>
>         (it sounds nice, but it's really not that useful/relevant in
> practice).
>
>         And in MVC, the UI is responsible for displaying the data anyway.
> (in the way the UI sees fit.)
>
>         So how does this make templates different from jsp anyway ?
>
>         All you have done is substituted
>                 <java>..java  code..</java> with
>                 <template-macro>....template code..</template-macro>
>
>         In both cases, you still have application objects, application code
> etc., (both global and session specific)
>         associated with your web app. And these are separate from your
> formatting jsp/template code. So
>         what the difference ? (apart from non java, artifical, template
> specific syntax in the case of template engines ?)
>
>         Best regards
>
>         --Hursh
>
>
>
>
> *****************************************************************************
> The information in this email is confidential and may be legally privileged.
> It is intended solely for the addressee. Access to this email by anyone else
> is unauthorized.
>
> If you are not the intended recipient, any disclosure, copying, distribution
> or any action taken or omitted to be taken in reliance on it, is prohibited
> and may be unlawful. When addressed to our clients any opinions or advice
> contained in this email are subject to the terms and conditions expressed in
> the governing KPMG client engagement letter.
> *****************************************************************************
>
> ___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to