Solved

Struts Display Table with dynamic columns on JSP

Posted on 2008-10-22
1
10,559 Views
Last Modified: 2013-11-24
I'm trying to get a dynamic table to work with <display:table>, and I can't figure it out.

I've gotten this to work:
<table >                  
            <tr class="tableHeader">
      <logic:iterate id="element" name="QueryDefinition" property="colNames">      
                 <th><bean:write name="element" /></th>
      </logic:iterate>
            </tr>
                        
            <logic:iterate id="row" name="QueryDefinition" property="queryResult">
      <tr>
          <logic:iterate id="item" name="row" property="columns" indexId="index">
                   <td class="TableRowH" align="right" style="word-break:break-all"><bean:write name="item"/></td>
      </logic:iterate>
      </tr>
           </logic:iterate>
                        
</table>

but the table would look so much nicer if I could get it to work with <display:table>. I can get this far:

<display:table width="100%" align="bottom" name="QueryDefinition.queryResult" id="row" requestURI="ViewQueryList.do" class="tableHeader">                  
     <logic:iterate id="item" name="row" property="columns" indexId="index">
          <display:column><bean:write name="item"/></display:column>
     </logic:iterate>
</display:table>

But I can't get the column titles part to work, any ideas?

Thanks!
0
Comment
Question by:joycie237
1 Comment
 

Accepted Solution

by:
joycie237 earned 0 total points
ID: 22791207
I figured it out:
<display:table name="QueryDefinition.queryResult" id="row" requestURI="ViewQueryList.do" class="tableHeader">                  
      <logic:iterate id="item" name="row" property="columns" indexId="index">
            <display:column title="${QueryDefinition.colNames[index]}"><bean:write name="item"/></display:column>
      </logic:iterate>
</display:table>
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now