var x; //is an string variable in javascript
var x=0; //is an integer variable in javascript
any how when you are passing in to database as string/int it will accept both the case to store.
but the problem will occure while when your page get's the value from the database to the front end.
better to implement your code in
java side in DAO LAYER to get the values in actual format
below methods returns actual value from 'E' format amt
strAmt is actual value cmg from database as 'E' value and number of decimal points eg [xxx.00 if it is 2]
File name : XXX.class
public static String convertToAmount(String strAmt, int noOfDecimal) {
String ret = strAmt;
if (strAmt == null || strAmt.trim().equals(""))
return strAmt;
try {
double d = Double.valueOf(strAmt).doubleValue();
NumberFormat nf = NumberFormat.getInstance();
nf.setMinimumFractionDigits(noOfDecimal);
nf.setMaximumFractionDigits(noOfDecimal);
ret = nf.format(d);
} catch (NumberFormatException nfe) {}
return ret;
}
eg: IN
JSP IMPLEMENTATION
import the XXX.class file and get the method like given below
<jsp
irective.page import="XXX.class"/>
var ival = '<%=XXX.convertToAmount(String.valueOf(Value),2)%>';
correct me if i am wrong.
please implement and see.
it is working for me.