Solved

Struts Display Table with dynamic columns on JSP

Posted on 2008-10-22
1
10,539 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

707 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

15 Experts available now in Live!

Get 1:1 Help Now