I wanted to fetch two double values from JDBC if they are null I want to populate them as null in my textfield and if they are 0 I wanted to populate my text field as 0. I've tried resultSet.wasNull but even if I'm getting 0 it is setting them as null value.
This is what I've written.
resultsetPricing = stmtPricingData.executeQuery();
while(resultsetPricing.next()){
if(pricetype.equals("Price List A")){
priceExclVat = resultsetPricing.getDouble("PRICE_EXC_VAT");
priceInclVat = resultsetPricing.getDouble("PRICE_INC_VAT");
if(priceExclVat == 0){
System.out.println("Inside if EXCL");
if(resultsetPricing.wasNull()){
System.out.println("Inside RESULT SET NULL EXCL");
exclVAT3.setValue(pageContext,null);
}
}else if(priceExclVat != 0 || priceExclVat == 0){
System.out.println("Inside ELSE EXCL");
priceExclVatStr = String.valueOf(priceExclVat).replace(".",",");
exclVAT3.setValue(pageContext,priceExclVatStr);
}
if(priceInclVat==0){
System.out.println("Inside if INCL");
if(resultsetPricing.wasNull()){
System.out.println("Inside RESULT SET NULL INCL");
inclVAT3.setValue(pageContext,null);
}
}else if(priceInclVat!=0 || priceInclVat==0){
System.out.println("Inside ELSE INCL");
priceInclVatStr = String.valueOf(priceInclVat).replace(".",",");
inclVAT3.setValue(pageContext,priceInclVatStr);
}
}
}
Pleas tell me what I'm doing wrong.