For input string: "..."

之前在项目中通过EL表达式从cart 中取出itemPirce这个值时始终报:For input string: "${cart.itemPrice / 100}" 错误。

事故原因:

  在通过视图解析器并把数据填充到ModelAndView对象中时出现无法取出itemPrice这个值(EL表达式无效)。itemPrice没有值则再通过 /100运算就会报错。

  还有一种现象是在表单中出现空值并提交到后台进行处理,而提交到后台的是 " " 而不是null,则会出现此错误。

原文地址:https://www.cnblogs.com/tongxuping/p/7343909.html