Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to iterate a arraylist and print values in table using logic:iterate

 
sa suresh
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all

i want to display a table with column name and values that have to fetch from database..
iam using scriplets in jsp as







this is the one iam using ... for displayinfg the values..

how to use logic:iterate for this

can help me..............
thanks in advance

-- Added UBB [ c o d e ] tags
[ February 17, 2007: Message edited by: Merrill Higginson ]
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why not give it a try yourself first?

Start by looking at the Struts logic taglib documentation. Then look at some examples here.

If you run into trouble, just post your code here and tell us what problems you run into, and we'll help out.
 
sa suresh
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi
this is the one i tried ....


<logic:notPresent name="columnList">
<h2> DataSource not in scope! </h2>

</logic:notPresent>
<logic resent name="columnList">
<logic:empty name="columnList">
<h2>No Data FOUND!</h2>
</logic:empty>
</logic resent>

<logic resent name="columnList">
<table>
<logic:iterate id="columnDisplay" name="columnList" type="java.lang.String">
<tr>
<td>
<bean:write name="columnDisplay" property="columnList"/>

</td>
</tr>
</logic:iterate>
</table>
</logic resent>


but throwing exception as

javax.servlet.jsp.JspException: No getter method for property: "columnList" of bean: "columnDisplay"

can you please help me out...

thanks in advance
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Change

to

Note that if the "bean" is a string, you can just specify the name without a property.

If you want to get the value of a column from the dataMap using a column name, here's the code you'd use:

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic