【送分】BigDecimal SQL对应MONEY 类型赋值,在线等
请教下这个是用表达式为何报错呢
//构造以字符串内容为值的BigDecimal类型的变量bd
java.math.BigDecimal f_amountmin_b=new java.math.BigDecimal(f_amountmin_s);
//设置小数位数,第一个变量是小数位数,第二个变量是取舍方法(四舍五入)
f_amountmin_b=f_amountmin_b.setScale(2, BigDecimal.ROUND_HALF_UP);
JSP执行报错信息为
HTTP Status 500 - An exception occurred processing JSP page /OCMS/inFrame.jsp at line 349
--------------------------------------------
type Exception report
message An exception occurred processing JSP page /OCMS/inFrame.jsp at line 349
description The server encountered an internal error that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: An exception occurred processing JSP page /OCMS/inFrame.jsp at line 349
346: }
347:
348: //
349: java.math.BigDecimal f_amountmin_b=new java.math.BigDecimal(f_amountmin_s);
350:
351:
352: //
Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handle
JspException(JspServletWrapper.java:568)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:470)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
root cause
java.lang.NullPointerException
java.math.BigDecimal.<init>(Unknown Source)
org.apache.jsp.OCMS.inFrame_jsp._jspService(inFrame_jsp.java:492)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
note The full stack trace of the root cause is available in the Apache Tomcat/7.0.42 logs.
------解决方案--------------------为空就不要转换了,或者赋值为0