Why don't you just return an array from 1 to lastDayInMonth?

.tml
t:source="rangeOfDates"

.java
public List<Integer> getRangeOfDates()
{
List<Integer> list = new LinkedList<Integer>();

for(Integer i=1; i <=lastDayInMonth; i++)
   list.add(i);

return list;
}


On Sun, Jul 8, 2012 at 10:55 AM, bhorvat <horvat.z.bo...@gmail.com> wrote:

> I have a strange problem with range operator, well it is eighter that or I
> dont know how to use it.
>
> I have tried the following
>
>  <t:loop t:source="1..31" t:value="day">
>     //html code
>  </t:loop>
>
> this works but my problem is that the number 31 needs to be dynamic so I
> have a property ${lastDayInMonth}
>
> However if I try
>
> <t:loop t:source="1..${lastDayInMonth}" t:value="day">
>     //html code
>  </t:loop>
>
> I get
>
> A JSONArray text must start with '[' at character 1 of 1..31
>
> and if I try
>
> <t:loop t:source="[1..${lastDayInMonth}]" t:value="day">
>     //html code
>  </t:loop>
>
> I get
>
> Caused by: java.lang.RuntimeException: Coercion of 1..31 to type
> java.lang.Integer (via String --> Long, Long --> Integer) failed: For input
> string: "1..31"
>
> So what am I dont wrong, ideas?
>
> cheers and tnx
>
> --
> View this message in context:
> http://tapestry.1045711.n5.nabble.com/Problem-with-range-operator-tp5714339.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>

Reply via email to