On Sunday 06 July 2008 04:25:45 dusty wrote:
> <s:iterator value="fruits">
> <%
>   Calendar cal = Calendar.getInstance();
>   cal.setTime(new Date());
>   int monthNow = cal.get(Calendar.MONTH);
>   cal.setTime(date); //fruit.getDate()
>   int monthFruit = cal.get(Calendar.MONTH);
>   if(monthNow == monthFruit){
>   %>
> delete delete
> <%}%>
> </s:iterator>
>
> If you don't like the script in the page then you can create a public
> method on fruit called getExpired.  fruit.getExpired() does the same
> calendar work as above based on the internal date value and the current
> date and returns a boolen. In that case:
>
> <s:iterator value="fruits">
>    <s:if test="expired">
>          delete delete
>     </s:if?
> </s:iterator>
>

I would go for this approach if only in so far as it keeps what looks like 
business logic out of your JSP pages and back in your domain object where it 
belongs.

Regards

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to