[Opensource] "zebra striping" question
Brian Rook
brian.rook at xor.com
Thu Aug 1 17:43:59 PDT 2002
okay, I see how that would work. however, I'm still a little stuck...
so in the iterate name attribute you can put in the name of any block that
is in the response. So if you have many blocks in the response and are
looking to iterate through one of them you can just use that one. Is this
correct?
so I have a block "TopicList" that contains another block called "Topic".
inside Topic I have an output "ATopic" which has attributes "TopicName" and
"TopicID"
Topic also contains another block called "SubTopic" which contains an output
called "ASubTopic" which has attributes "SubTopicName" and "SubTopicID".
I tried to iterate through these blocks with the iterate tag, but I kept
getting an exception...
with this code:
<logic:iterate id="eachItem" property="TopicList" indexId="counter">
<bean:write name="eachItem" property="Topic"/>
</logic:iterate>
it would say "No such property as 'Topic' in Block 'ATopic'"
I appreciate the help...
b
-----Original Message-----
From: opensource-admin at jcorporate.com
[mailto:opensource-admin at jcorporate.com]On Behalf Of Michael Rimov
Sent: Thursday, August 01, 2002 2:04 AM
To: opensource at jcorporate.com
Subject: Re: [Opensource] "zebra striping" question
At 02:05 AM 8/1/2002 +0100, you wrote:
>Have you used Struts <logic:iterate> tag. There is a tag attribute called
>"indexId" where name a JSP page attribute to store a java.lang.Integer
object.
>
><logic:iterate id="row" name="databaseRows" indexId="counter">
WOW, thanks Peter!!
Turns out that even though the code for the Expresso extension to iterate
included all the code for indexId, the attribute for the counter wasn't
included in the expresso-logic.tld. I've fixed that and will check it into
CVS before the night is through.
So, for the record, here's a sample that's iterating over a block that
contains two outputs with each block.
<logic:iterate id="eachItem" property="Blocks" indexId="counter">
<%
String cssClass = "dataset";
if(counter.intValue() % 2 != 0) {
//Alternate row style
cssClass = "dataset-alt";
}
%>
<tr class="<%=cssClass%>">
<td width="62%"><bean:write
name="eachItem" property="/Output1"/></td>
<td width="38%"><bean:write name="eachItem"
property="/Output2"/></td>
</tr>
</logic:iterate>
Sandra, could you add this one to the FAQ?
Again, thanks Peter!
-Mike
_______________________________________________
Opensource mailing list
Opensource at jcorporate.com
http://mail.jcorporate.com/mailman/listinfo/opensource
Archives: http://mail.jcorporate.com/pipermail/opensource/
More information about the Opensource
mailing list