Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Creating HTML files from Java accessing Oracle

Re: Creating HTML files from Java accessing Oracle

From: Roedy Green <look-on_at_mindprod.com.invalid>
Date: Mon, 21 Jun 2004 20:53:57 GMT
Message-ID: <47ied012mb8ugcga6htt1jrvtcll18mch3@4ax.com>


On 21 Jun 2004 13:40:55 -0700, mackdaddy315_at_hotmail.com (DM) wrote or quoted :

>I guess I am looking for
>methods that would make things easier rather than just outputting
>print commands line by line. :)

First use CSS.

Then internally have objects provide their own wrappers, e.g. String getText()
  { return text; }

String getHTML()
  { return "<span class=\"custname\">" + entify( text ) + "</span">; }

Then you can knock out the HTML like this:

 out.println( thing.getHtML() + thing2.getHTML() );

And you don't have to think about making tags balance.

You can create code like this

String li ( String body )
{
return "<li>" + body + </li>;
}

This is ever so much easier than trying to keep track of balancing yourself.

don't try to make it readable with indents and line breaks. Use a beautifier if you have to examine the output.

See http://mindprod.com/products.html#ENTITIES for code to insert and remove entities.

you might do something to collapse two identical class spans into one. and to collapse multiple spaces into one.

-- 
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming. 
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
Received on Mon Jun 21 2004 - 15:53:57 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US