ECS is great when you are generating data programmatically--you can
write code that generates HTML/XML as it traverses some structure.

Thereare a variety of good template systems which you can use in the
other case--where you basically know what the page should look like,
and you want to drop some dynamic content into it.

One such framework is WebMacro (which is free), which introspects
objects to determine what information it could pull out (ie: bean style).

   http://webmacro.org/

So you would create a template like this:

      <html><head><title>$title</title></head><body>
         <h1>Customer: $customer.Name</h1>
         Outstanding balance is $customer.Account.Balance
      </body></html>

This template gets compiled into an efficient form and shared between
servlets; thus it is what Luther called a shared object.

You use it like this:

     Customer cust = ...;

     context.put("title","Customer Account Balance");
     context.put("customer", cust);

And WebMacro takes care of figuring out how to extract the required
information; in this case perhaps by calling

     $customer.Name --> Customer.getName()
     $customer.Account.Balance --> Customer.getAccount().getBalance()

Of course you can also loop through lists of customers, conditionally
include stiff, and so forth,

  http://webmacro.org/

Justin

Quoting Raphael Gillett ([EMAIL PROTECTED]):
> Hello everyone,
>
> I agree wholeheartedly with Luther's aim of reducing
> unnecessary, tedious & errorprone typing.
>
> Jon's ECS solution does not achieve that goal, because
> it involves a lot of extra typing (e.g. many out.println
> statements are simply replaced with many addElements).
> Of course ECS is useful for other purposes.
>
> Luther has identified a much-needed feature that
> would benefit us all.
>
> We should be wary of the "Real Java Programmers
> don't ... "  reaction.   The key questions are those of
> utility and non-duplication.
>
> Raphael Gillett
>
>
>
> jon * wrote:
>
> > > Probably it's not just servlet having the problem.
> > > I found java in general not handy at handling the
> > > println method to print out a block of text for example.
> > >
> > > It's very easy in perl to print out a block of text  like
> > > print <<THEEND
> > > what ever the text
> > > .....
> > > THEEND
> > >
> > > but with Java, you have to print out each line...
> > > and I also found println("( " + variabel + ") " + variable + "some text" );
> > > is hard to read.
> >
> > <http://java.apache.org/ecs/>
> >
> > No more out.println!!!!
> >
> > -jon
> >
> > ___________________________________________________________________________
> > 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

___________________________________________________________________________
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