struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "JoAnn Lemm" <>
Subject Dynamic data html generation - revisited
Date Thu, 08 Jul 2004 21:57:35 GMT
Hmmm ... yes, what I need is somewhat more complex as I'm trying not use
include scriptlets in the jsp --- only taglib calls.

Here's the jist...

I have an arraylist of objects in my bean representing a table.  Each
entry in the arraylist represents a row in the table. The attributes in
the object represents the columns of the row.

I'm trying to figure out how to use struts such that this dynamic set of
data is displayed properly.   Some of the columns may also contain links
to other pages.

Currently, I am generating the html in my form bean and serving it up
that way... but there's got to be a way for me to keep the html in the
jsp and the java in the bean.  I highly suspect that I'm doing this the
hard way.

Here's a snippet of the code in the form bean:

// for each row...
for (int i = 0; i < size; i++)
          br = (BatchResult)batchResults.get(i);
          text.append("<td width='64' align='middle'><font
class='normaltxt'>" +
                      br.getFirstname() + "</font></td>\n");
          text.append("<td width='10' align='middle'><font
class='normaltxt'>" +
                      br.getMiddleInitial() + "</font></td>\n");
          text.append("<td width='64' align='middle'><font
class='normaltxt'>" +
                     br.getLastname() + "</font></td>\n");
          text.append("<td width='20' align='middle'><font
class='normaltxt'>" +
                     "<img border='0' src='images/tearsheet.png'>" +
          // more columns follow...
          text = new StringBuffer();
        return list;

In my jsp:

<logic:iterate id ="list5" name="batchForm" property="tableHTML">


-----Original Message-----
From: Jim Barrows [] 
Sent: Thursday, July 08, 2004 12:58 PM
To: Struts Users Mailing List
Subject: RE: Dynamic data html generation

> -----Original Message-----
> From: JoAnn Lemm []
> Sent: Thursday, July 08, 2004 12:55 PM
> To: Struts Users Mailing List
> Subject: Dynamic data html generation
> Hi All,
> I have a set of data that needs to be displayed in an html table. Each
> column has its own formatting.  The data are stored as rows in an
> ArrayList in the Form bean.  How can I create this HTML table using
> struts without resorting to building the table in the bean.

Unless you're asking a different question then I'm reading:
All display logic is done in the JSP and not the bean.  So you'd use JSP
tags and HTML tags to 
accomplish your task.  

Given that you're here, this seems like an incredibly obvious answer to
the question, so I don't think 
it's what you're looking for.  Would you mind clarifying?

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

View raw message