velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sudhi Tekkala" <sudhitekk...@gmail.com>
Subject hello sir (velocity doubt)
Date Wed, 20 Jun 2007 04:11:13 GMT
hello sir

actually i am using the velocity 1.5 version itself.... and as if i am going
to use or declare the variable with out the qutations like this:::

#set($a=300.05)
#set($b=500.05)
#set($c=$a+$b)

the velocity engine is displaying some errors like:::

*type* Exception report

*message*

*description* *The server encountered an internal error () that prevented it
from fulfilling this request.*

*exception*

javax.servlet.ServletException:
org.apache.velocity.exception.ParseErrorException: Lexical error:
org.apache.velocity.runtime.parser.TokenMgrError: Lexical error at
line 66, column 48.  Encountered: "2" (50), after : "."
	org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:518)
	org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:421)

*root cause*

org.apache.velocity.exception.ParseErrorException: Lexical error:
org.apache.velocity.runtime.parser.TokenMgrError: Lexical error at
line 66, column 48.  Encountered: "2" (50), after : "."
	org.apache.velocity.Template.process(Template.java:141)



so my thinking is that the decimal points placed in the float or double
value are not detected and if we use qutations ... it is taking the value
as a string but not as float or double...

so please kindly help me in this matter

thanking you



On 6/19/07, Will Glass-Husain <wglasshusain@gmail.com> wrote:
>
> Dear sudhitekkala,
>
> [I'm replying to the user@velocity.apache.org list, which is a better
> place for support and help for Velocity]
>
> Are you using the latest Velocity 1.5?  Previous versions didn't support
> decimal numbers.
>
> Also, I note that your example is not correct.  There should be no quotes
> around the numbers.
>
> #set($a=300.05)
> #set($b=500.05)
> #set($c=$a+$b)
>
> Hope this helps.
>
> Best regards, WILL
>
> On 6/19/07, sudhitekkala <sudhitekkala@gmail.com> wrote:
> >
> >
> > hello guys
> >
> > actually a problem is araising when i am trying to add the float values
> > or
> > variables in the velocity... for example::
> >
> > #set($a=300)
> > #set($b=500)
> > #set($c=$a+$b) is working correctly and 800 value is displayed
> >
> > but when i am working with the float values i am not getting the
> > calculation
> > like:
> >
> > #set($a="300.05")
> > #set($b="500.05")
> > #set($c="$a+$b") is not working ........... it is showing the value as
> > "$c"
> > in the html page
> >
> > please provide me the guidence......that how to add the two float or
> > string
> > or integer+float values in the velocity page........
> >
> > --
> > View this message in context:
> > http://www.nabble.com/adding-float-values-in-velocity%28velocity-variable-reference%29-tf3945800.html#a11192911
> > Sent from the Velocity - Dev mailing list archive at Nabble.com.
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscribe@velocity.apache.org
> > For additional commands, e-mail: dev-help@velocity.apache.org
> >
> >
>
>
> --
> Forio Business Simulations
>
> Will Glass-Husain
> wglass@forio.com
> www.forio.com




-- 
Regards,
Sudheer T.
Bilingual Software Engineer
SoftBridge Solutions,
PrabhatRoad,
Pune.
919823377838

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message