OK, I am now able to get the iterate tag to work, but the comparison is
still not working. I have this now:
<logic:iterate id="tz" name="timezones">
<logic:equal name="accountProfileForm" property="timeZone"
value="${tz}">
<bean:write name="tz" property="label"/>
</logic:equal>
</logic:iterate>
But the problem is that the "value" that I want to compare in the
logic:equal tag is really ${tz}.value. But how can I set the value to
the "getValue()" from the "tz" variable.
Daniel
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Friday, March 03, 2006 12:52 PM
To: Struts Users Mailing List
Subject: Re: Logic Tag Question
If I am not mistaking you will use either the collection or the property
attribute but not both.
http://struts.apache.org/struts-taglib/tagreference-struts-logic.html#lo
gic:iterate
For each iteration of the loop you should be able to compare the value
of the
id property in you logic:equal tag to the forms value by saying
<logic:iterate id="tz" collection="timezones">
<logic:equal name="accountProfileForm" property="timeZone"
value="${tz}">
//do something
</logic:equal>
</logic:iterate>
Bryan LaPlante
---------- Original Message -----------
From: "Kalcevich, Daniel" <[EMAIL PROTECTED]>
To: [email protected]
Sent: Fri, 3 Mar 2006 12:21:18 -0800
Subject: Logic Tag Question
> I have the following:
>
> - An ArrayList<LabelValueBean> in the ServletContext called
> "timezones"
>
> - A Form Bean in the request scope called
"accountProfileForm"
>
> I want to be able to loop through the values in the "timezones"
> attribute and compate the "value" to the value of the "timeZone" in
the
> "accountProfileForm". Here is what I am trying:
>
> <logic:iterate id="timeZones" collection="timezones" property="value">
>
> <logic:equal name="accountProfileForm" property="timeZone"
> value="timeZones.value">
>
> <bean:write name="timeZones" property="label"/>
>
> </logic:equal>
>
> </logic:iterate>
>
> I get the following error:
>
> 12:16:59,031 ERROR [action]:253 - Servlet.service() for servlet action
> threw exception
>
> javax.servlet.jsp.JspException: ServletException in
> '/jsp/templates/tab_content_template.jsp': ServletException in
> '/jsp/account/account_profile_form.jsp': Cannot create iterator for
this
> collection
>
> at
>
org.apache.struts.taglib.tiles.InsertTag$InsertHandler.doEndTag(InsertTa
> g.java:923)
>
> Can someone point me in the right direction or let me know what is
wrong
> with the above? Thanks.
>
> Daniel
------- End of Original Message -------
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]