On 12/29/2009 01:56 PM, Caleb James DeLisle wrote:
That's interesting,
I had that issue when calling search with start and nb
#if($request.startAt)
$request.startAt is $request.get('startAt') which is
XWikiServletRequest.get(String) which always returns a String.
#set($start =
$mathtool.toInteger($request.startAt))
#else
#set($start = 0)
#end
#set ($results = $xwiki.xWiki.getHibernateStore().search($query, 50,
$mathtool.toInteger($start), $context.context))
With $start rather than $mathtool.toInteger($start) it failed.
Caleb
Sergiu Dumitriu wrote:
> On 12/29/2009 10:33 AM, Caleb James DeLisle wrote:
>> Good luck, remember that velocity converts everything to Strings so something
like
>> #set($x = 1)
>> $xwiki.methodRequiringInteger($x)
>> will fail because velocity turns 1 the number into "1" the 1 character
string
>> I think $mathtool has a way to convert it back.
>
> No, that's not true.
>
> {{velocity}}
> #set($x = 1)
> $x.class
> {{/velocity}}
>
> Prints:
>
> class java.lang.Integer
--
Sergiu Dumitriu
http://purl.org/net/sergiu/