how to remove leading zeros from a session variable in jsp
i have a session variable -${reData.totalCharge}
it may have values like 000000033
开发者_运维问答. when I display the value in JSP I need only 33
to be displayed. how do you do this ? this is defined as string as the data is stored as charecter in DB2 database.
Integer.parseInt(value)
would work. But do that in the preprocessing code, rather than in the JSP. Also, <fmt:formatNumber />
should work.
But ultimately - try fixing this in the database. You shouldn't be storing integers as strings.
精彩评论