Raphael Gillett wrote:
>
> Hello everyone,
>
> I agree wholeheartedly with Luther's aim of reducing
> unnecessary, tedious & errorprone typing.
>
> Jon's ECS solution does not achieve that goal, because
> it involves a lot of extra typing (e.g. many out.println
> statements are simply replaced with many addElements).
> Of course ECS is useful for other purposes.
>
> Luther has identified a much-needed feature that
> would benefit us all.
Rather than introducing here-documents and similar syntax in Java to
produce HTML, I prefer to follow a model with separation of code and
HTML. You write your HTML, then read it with the code, manipulate it
programmatically, and output the result.
I have a DocParser interface that includes these two methods:
public void setParameter(String widgetname, String propname, String
propvalue);
public void setParameter(String widgetname, int offset, String
propname, String propvalue);
(Thinking now, maybe setParameter is not the best name, but is what I
have now). The first method allows to set the value [propvalue] of an
attribute called [propvalue] of the [widgetname] tag. The second version
includes an offset to locate a tag relative to another one (for example
an anchor), as this avoids having to deal with non-standard tags, but is
dangerous when you modify the HTML file with an editor and inadvertently
introduce additional tags.
I have an "HtmlDocParser" class that implements the interface for HTML,
and you can do for example:
document.setParameter("message", "value", msg);
My code is not opensource, but there's a free package called HtmlScreen
that does a similar thing.
Carlos
___________________________________________________________________________
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