Solved

Struts Display Table with dynamic columns on JSP

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
iterator/ListIterator approach 17 50
eclipse buid path vs tomcat lib path 10 37
How to configure empty element in XML Document parser? 15 44
import as existing maven project 3 33
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…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…

680 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