On Thu, 27 Dec 2001, Rami Developer wrote:

> Hi,
>    I am using servlets and would like to have a
> template file for my HTML instead of hard coding it in
> the servlet.
>    Currently I am using a "dump" way, by storing the
> template (HTML file in this case). Then, whenever the
> servlet is requested, it reads the template and
> inserts the dynamic data in place of some predefined
> string, e.g. a comment. Afterwards, the servlet
> displays the new HTML to the user.
>
>    My question : is there a better (smarter) way to do
> that? If yes, I will appreciate an example, article to
> read or a hint in the worst case.

Well, if you're going to be doing something like this, I'd suggest not
reinventing the wheel but instead using one of the template systems
already out there (sounds like they do just the kind of thing you're
describing).  I haven't evaluated them (although they've been
discussed lots on this list, check the archives), but the ones I
recall are webmacro, freemarker, there's one available through
jakarta/apache (velocity?).  Oh, and TEA might be another one.  Jason
Hunter covers such template systems somewhat in the second edition of
his Java Servlet Programming book (and I think he's a TEA aficionado).

Milt Epstein
Research Programmer
Software/Systems Development Group
Computing and Communications Services Office (CCSO)
University of Illinois at Urbana-Champaign (UIUC)
[EMAIL PROTECTED]

___________________________________________________________________________
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