tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Will Hartung" <>
Subject Re: is there a tag or some kind of mechanism that would do the following ...
Date Tue, 25 Feb 2003 22:19:26 GMT
> From: "Karr, David" <>
> Sent: Tuesday, February 25, 2003 1:53 PM
> Subject: RE: is there a tag or some kind of mechanism that would do the
following ...

> I'd say your best strategy is to approach this problem from a different
> direction.  Instead of figuring out how to make it easy to emit HTML
> from your servlet, work on building JSP custom tags which emit small
> logical pieces, and then reference those tags from your JSP pages.

That could work, if the code was used enough to make reusing it viable.

It's one of those fine lines between a JSP and a Servlet.

Another thing that could be done is simply writing a local class method:

private void p(String s)
throws IOException

Then, your code becomes:

etc. That can help simply reduce the boiler plate of printing it out.

Finally, I'd look at creating a simple script is any convenient language
that simply converts an HTML file into "java", and then cut-n-paste in into
your code.

Now, I find cut-n-paste to be one of the great evils of the development
communiity, but sometimes it is appropriate for one-off "code generation"

If you keep the original HTML around, then you don't have to worry editing
in place, simply edit the master, run the filter, and re cut-n-paste.

Here's a simple sed(1) script:
sed -e 's/"/\\"/g' -e 's/.*/out.println(&)/g'


Will Hartung

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message