This is essentially what WebMacro does, only it's very clever about
extracting values from objects/beans via introspection; and has a
script language which allows looping, conditions, etc.
http://www.webmacro.org
It also caches parsed versions of the template for faster execution;
and it's free.
Justin
Quoting Martin Gloeckle ([EMAIL PROTECTED]):
> *** if you have that a lot, it might make sense to build a little system
> that reads in an html template. within the template you have placeholders
> (example ##data##).
>
> you read the html, parse it for place holders and replace the placeholders
> dynamically with whatever data you have (eg. just a string, some previous
> user input, a database result)
>
> i did build something like that, don't have handy right now. this is the
> interface:
>
> public class template {
> public template(String fileName); // create a new template from the
> specified file
>
> public addStringSite(String placeHolder, String replacement); //
> replace the placeholder with the replacement string. this adds it into an
> internal hashtable
>
> public play(PrintWriter out); // starts parsing the template file
> prints it out until it comes across a placeholder. when it encounters a
> placeholder it looks into the hashtable for a replacement and prints that
> one out. then it continues.
>
> }
>
>
> i think this is how it works for me.
>
> hope that helps.
>
>
> - martin
>
>
>
> -----Original Message-----
> From: Jeetandra Mahtani [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, April 21, 1999 11:08 AM
> To: [EMAIL PROTECTED]
> Subject: Need a suggestion for writing a lot of html....
>
>
> Hello,
> I have a lot of html that I am sending to a client
> such as
> <tr>
> <td width="17%"><small><small><font
> color="#FF0000"><strong>Bill to Number:</strong></font>
> </small></small></td>
> <td width="16%"><small><small><input type="text"
> name="C1BTNO" size="11"
> maxlength="11"></small></small></td>
> <td width="33%"></td>
> <td width="34%"></td>
> </tr>
> and I am writing it by
> out.println(.....)
> out.println(.....)
> Now this is becoming really cumbersome to do a
> out.println and then insert a \, in front of every " .
> Can someone please provide any suggestion on how to
> get this done faster.
> Thanks,
> J
>
>
>
>
>
>
> _________________________________________________________
> DO YOU YAHOO!?
> Get your free @yahoo.com address at http://mail.yahoo.com
>
> ___________________________________________________________________________
> 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