Jump to content

Can't cast String to Long in jasper


dheeraj.madhu
Go to solution Solved by dheeraj.madhu,

Recommended Posts

I am trying to convert a String value to long in jasper report and convert it to Date object. But i always end up getting a class cast exception from String to Long.


java.lang.String cannot be cast to java.lang.Number



I am trying following code


<variable name="date" class="java.util.Date">                                                                                                                                                  <variableExpression><![CDATA[new Date(Long.getLong($F{field}))]]></variableExpression>                                                                                         </variable>[/code]
 

Long.getLong(String s) gives desired output in Java. But when we use same java expression it gives exception in jasper. Does jasper treats primitive java types differently?


Link to comment
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...