opensubscriber
   Find in this group all groups
 
Unknown more information…

e : ecs-user@jakarta.apache.org 22 February 2009 • 3:56PM -0500

learning API for table
by Thufir

REPLY TO AUTHOR
 
REPLY TO GROUP




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@jaka...
For additional commands, e-mail: ecs-user-help@jaka...

Bookmark with:

Delicious   Digg   reddit   Facebook   StumbleUpon

Related Messages

opensubscriber is not affiliated with the authors of this message nor responsible for its content.