tarun Narang <[EMAIL PROTECTED]> wrote:
> Can anyone tell me that how the string can be converted into  int in VTL
> I am recieving the value in count variable through getRequest but this
> variable has a string value and i have to add some int value in this count
> variable like $count + 5.
>   #set ($count = $!data.getRequest().getParameter("countRow"))

It's only necessary to ask a question once, by the way.

I'd perform this conversion using the NumberTool.

ie, once you have $numberTool installed in your context,

$numberTool.toNumber($count)  <-- The result of this operation will be of 
class Number


http://jakarta.apache.org/velocity/tools/generic/
http://jakarta.apache.org/velocity/tools/javadoc/org/apache/velocity/tools/generic/NumberTool.html

Note that tools like NumberTool are just plain old java objects, and you can 
put them into your context in many ways, the easiest of which is.

context.put("numberTool", new 
org.apache.velocity.tools.generic.NumberTool());

-Mike

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

Reply via email to