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" <[email protected]>
To: <[email protected]>
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: [email protected]
For additional commands, e-mail: [email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]