This week's giveaway is in the Testing forum.
We're giving away four copies of TDD for a Shopping Website LiveProject and have Steven Solomon on-line!
See this thread for details.
Win a copy of TDD for a Shopping Website LiveProject this week in the Testing forum!
  • 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Struts2---Problem to use s:iterator and s:date to display and pass value

 
Ranch Hand
Posts: 159
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
in my Action class has below two variables

Collection<Date> dates;
Date date;

In jsp, how to use s:iterator and s:date to display and pass value for reportdate ? below is my code snippet´╝î see red color marked area

<s:iterator value="dates" status="reportdate">
<tr
class="<s:if test="#reportdate.odd==true">odd</s:if><s:else>even</s:else>">
<s:url id="listmorningurl" action="listmorningReport">
<s:param name="date" value="reportdate" />
</s:url>
<s:url id="listalerturl" action="listalertReport">
<s:param name="date" value="reportdate" />
</s:url>
<td><s:date name="reportdate" format="dd/MM/yyyy"/></td>

<td><s:a href="%{listmorningurl}">
<s:text name="key.morningreport" />
</s:a></td>

<td><s:a href="%{listalerturl}">
<s:text name="key.alertreport" />
</s:a></td>
</tr>
</s:iterator>
 
Ranch Hand
Posts: 141
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I would recommend leveraging JSTL. It's just easier at times...

Here's a date example:
<fmt:formatDate value="${myCollection.myValue}" type="date" dateStyle="short" />

as far as your url parameter goes - assuming you actually have a variable in your collection called 'reportdate' that is accessible to your jsp (public getter/setter) , it should work.
 
Blood pressure normal? What do I change to get "magnificent"? Maybe this tiny ad?
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic