开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜