Quoting Richard Friedman ([EMAIL PROTECTED]):
>
> 1. Looping.
> How have you handled looping in your template
> language. Not that this is impossible, but you
> probably have created your own mini-language. Also,
> can you handle loops within loops?
Most templates have a mini-language, but unlike JSP, make no
attempt to provide a general purpose programming environment
inside a webpage. So the loops are simplified, and deal with
whether or not to repeat a block of text--they're not program
flow control statements.
WebMacro can loop within loops within loops, and I assume so
can any other decent template system.
> 2. Performance.
> The act of playing templates I could imagine be more
> costly than JSP style coding.
In general a template should have better performance than JSP. In
the case of WebMacro in particular it should be about the same since
it uses Java beans (and therefore some introspection) like JSP does.
Other template systems have chosen to require the programmer to
adhere to specific interfaces so that the template execution can
proceed without introspection.
If you take a step back and look, JSP is just a template system
that does not attempt to enforce any design constraints on the
application (no separation of interface/view from logic/program).
Probably JSP has had more optimizing done than WebMacro, since I've
done hardly any (I stopped optimizing when it got fast enough to
satisfy everyone on the mailing list). There's no theoretical reason
why JSP would be any slower or faster than WebMacro or any other
template system.
> Not including whatever
> caching mechanism you might have, there is still
> processing of the template logic.
> I assume that
> everytime you hit a placeholder, you have some action
> being triggered. Your engine is doing all the work,
> why not have the templates themselves drive the
> process by converting them to java and let them run
> themselves. Yes, I know, this is JSP. ( IMHO, JSP
> was the next logical step from template-style engines.
JSP is a template system. WebMacro compiles in memory, and doesn't
write out bytecode, but it could be written that way. From the point
fo view of the user, all of this is fairly irrelevant.
> 3. Templates separate things too cleanly!
> In your template approach, imagine you wanted to
> change the appearnce of a single cell within a table
> based on some value. This is not business logic, but
> presentation logic, hence having the ability to code
> within your template based on what the template is
> about to display, is a clean separation. Also, for
> more detail on separating code see sun's application
> programming model (http://java.sun.com/j2ee). I do
> not agree with everything in there but it is a good
> start.
Any decent template system does provide you with enough layout power
that you'll be able to do this. The difference is that the "script"
inside the template is not program flow logic, but presentation logic.
So WebMacro has an if statement, but all it does is conditionally include
a block of text (not a program code branch).
It's a subtle but important difference--it enforces the design requirement
of separating presentation from business logic, but at the same time gives
you the power to implement effective presentation logic.
WebMacro was recently selected as one of the three best servlet products
of 1999, by the Java Report, in the current issue.
Justin
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
FAQs on JSP can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html