WebMacro (www.webmacro.org) might help you. You write HTML templates in its
script language, and then pass Java objects to it. It introspects your
objects to pull out the properties references in the templates.
eg:
Customer fred = ...;
context.put("fred", fred);
then in the template you can write:
<h1>$fred.Name</h1>
Current balance : $fred.Account.Balance
Telephone number: $fred.Phone
Current orders:
<ul>
#foreach $order in $fred.Orders {
<li>$order.Product: $order.Number
}
</ul>
and that would wind up calling methods like Customer.getName(),
Customer.getPhone(), Order[] arry = Customer.getOrders() and
then Order.getProduct() and ORder.getNumber(), etc.
If you aren't looking for a template based solution you could look
at something like ECS (element construction set) which might be
more suitable. It's on the java.apache.org site somewhere.
WebMacro lives on its homepage: www.webmacro.org.
Justin
Quoting Andrew Phelps ([EMAIL PROTECTED]):
> This question is a more general servlet question rather than JRun (so please
> forgive).
>
> I am looking for a package which wraps HTML into a set of classes allowing
> me to generate HTML in a method call.
> I am aware of WebLogics htmlKona product which partially meets my
> requirements. However, I would ideally like a package that reads the a HTML
> format layout (e.g h1 color) from an external file (say CSS) and format the
> HTML output accordingly (rather than formatting directly in the method
> call). Does anyone know of such a (glorious) package?
>
> Much appretiated,
>
> Andy Phelps
> ------------------------------------------------------------------------------
> Archives: http://www.egroups.com/group/jrun-interest/
> Unsubscribe:
>http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/jrun_talk
> or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the
>body.
------------------------------------------------------------------------------
Archives: http://www.egroups.com/group/jrun-interest/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/jrun_talk
or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the
body.