0
我用JavaScript字符串值發送到Grails的服務器,該值爲「0.5」「0.5」不能鑄造龍常規
$.post(myURL,{scale:"0.5"},fnPost);
當我蒙上它如下:
Long scale= params?.scale as Long ;
我得到:
For input string: "0.5". Stacktrace follows:
java.lang.NumberFormatException: For input string: "0.5"
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
at java.lang.Long.parseLong(Long.java:419)
at java.lang.Long.valueOf(Long.java:525)
真的,它是在常規奇怪地看到「0.5」不能被強制轉換爲長!