Quoting Steve Buonincontri ([EMAIL PROTECTED]):
> What are servlet templates? are they presentation templates?
>
> - steve

A servlet template is an object that processes text "filling in the
blanks" with values from some data set. The idea is to use it to
produce HTML:

   <html>....$someVariable..<tag>$someOtherVariable</tag>...</html>

Most template systems also have the ability to do some basic flow
control, conditional logic, etc., and some go further than that. A
template typically does not allow you to insert arbitrary Java code,
but limits itself to generating HTML.

The idea is that your code is cleaner and easier to read if there is
no HTML strewn through it, and similarly the HTML is easier to edit
if it is not embedded in code.

WebMacro is an example of a template system that is free:

   http://webmacro.org

In addition to the above, WebMacro also performs bean-style class
analysis to work out how to extract properties from regular objects,
so that as the program you don't have to work out the mapping yourself.

Obviously I'm biased, since I'm the principal author of WebMacro. Other
similar systems are FreeMarker, and also I believe that Enhydra has one.
They don't do the class analysis, but are largely equivalent to WebMacro
in other respects.

One key point about template systems as opposed to JSP is that the
template system is under your control as the Java programmer in the
servlet: you can choose when and how you want to use it, you aren't
forced to use it all the time--even within the same servlet you could
use it sometimes and not others.

Justin

---
WebMacro Servlet Framework
http://webmacro.org

___________________________________________________________________________
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