jakarta-ecs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Zachary Mitchell, BCIS" <zac....@internode.on.net>
Subject Re: learning API for table
Date Sun, 22 Feb 2009 22:07:41 GMT
Mate,

IMHO, having a bean/java object

for something as trivial as an HTML

TD with text contents

really isn't worth the overhead

you'll incur for each row of your table.

Consider Having one bean for the entire table,

and something like a LinkedList,

with each node in that each td.

Just an opinon, unless

there's more going on with your program!

Zac, Australia.





----- Original Message ----- 
From: "Thufir" <hawat.thufir@gmail.com>
To: <ecs-user@jakarta.apache.org>
Sent: Sunday, February 22, 2009 5:26 PM
Subject: learning API for table


> Possibly it's a weakness with HTML, but I can't seem to get results which
> make sense.  What I want to do is something like:
>
> get a bean, representing a row
>
> each bean attribute corresponds to a TD instance?
> Loop through the List of attributes and:
>
> add each TD instance to TR, right now I'm adding directly to the table.
>
> add the TR to the table
>
> go to the next element in the list
>
>
>
> if my Java is weak, or generics are wrong, please let that go.  I'm just
> trying to generate a table at the moment (in a servlet).
>
>
>
> code snippet:
>
>
>        for (SyndEntry syndEntry : rows) {
>            TR row = new TR();
>            row.setPrettyPrint(isPretty);  //need to set props file
>            TD title = new TD();
>            title.setPrettyPrint(isPretty);
>            TD link = new TD();
>            link.setPrettyPrint(isPretty);
>            List<TD> tds = new ArrayList<TD>();
>
>            title.addElement(syndEntry.getTitle());
>            link.addElement(syndEntry.getLink());
>            tds.add(link);
>            tds.add(title);
>
>            table.addElement(row);  //why doesn't this go last?
>                                    //why not add the TD obj's
>                                    //to the row?
>
>            for(TD td : tds){
>                td.setPrettyPrint(isPretty);
>                table.addElement(td);       //this seems wrong
>            }
>        }
>
>
>        doc.appendBody(table);
>
>
>
>
> the above works, but it seems clumsy.  Of course, I'm mixing the view in
> with everything else at the moment, but ignoring that for now, pls.
>
>
> thanks,
>
> Thufir
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ecs-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: ecs-user-help@jakarta.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: ecs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: ecs-user-help@jakarta.apache.org


Mime
View raw message