• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

logic:iterate works with an arraylist. However can it work with an object to perform a comparison?

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am new to struts and I am trying to learn logic:interate.

I am trying make changes to the following code.


<logic:iterate name="testDateStrList" id="testDate">
<p>
List Messages <bean:write name="testDate"/>
</p>
</logic:iterate>


I created this on my action

String myDate = "01/01/2013";
request.setAttribute("myDate",myDate);


on my jsp I want to test the arraylist value with my object.
I know that the logic:iterate works with an arraylist. However can
it work with an object to perform a comparison?


<logic:iterate name="testDateStrList" id="testDate">
<p>
List Messages <bean:write name="testDate"/>
</p>

<C:if test="${testDate == myDate}">
<h2>hey the daate is <c:out value="${testDate}"/></h2>
</C:if>
</logic:iterate>

In this example it passes the if statement no matter what.

My results.... Not sure what the if statement is comparing.
This (testDate == myDate) should be 2 string . I am not sure


List Messages 01/10/2013

hey the daate is 01/10/2013
List Messages 07/01/2013

hey the daate is 07/01/2013
List Messages 06/18/2013

hey the daate is 06/18/2013
List Messages 01/01/2013

hey the daate is 01/01/2013
List Messages 06/19/2013

hey the daate is 06/19/2013


reply
    Bookmark Topic Watch Topic
  • New Topic