aspose file tools*
The moose likes Struts and the fly likes how to iterate a arraylist and print values in table using logic:iterate Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "how to iterate a arraylist and print values in table using logic:iterate" Watch "how to iterate a arraylist and print values in table using logic:iterate" New topic
Author

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

sa suresh
Greenhorn

Joined: Feb 16, 2007
Posts: 4
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

Joined: Feb 15, 2005
Posts: 4864
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.


Merrill
Consultant, Sima Solutions
sa suresh
Greenhorn

Joined: Feb 16, 2007
Posts: 4
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

Joined: Feb 15, 2005
Posts: 4864
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:

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