Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Struts Display Table with dynamic columns on JSP

Posted on 2008-10-22
1
10,597 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 our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Configure a Bean in an XML file 4 42
jsp insert to database example 2 44
Java Restore security prompts not working 10 56
java example issue 3 22
I had a project requirement for a displaying a user workbench .This workbench would consist multiple data grids .In each grid the user will be able to see a large number of data. These data grids should allow the user to 1. Sort 2. Export the …
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:

839 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