Hi everyone. I'm testing this code: <fmt:formatNumber type = "currency" groupingUsed = "true" > ${ table_data.package_price + ( road_assistance_2year == '-' ? 0.0 : road_assistance_2year ) + ( comp_offer_data.hasInsurance ? table_data.insuranceValue : 0.0 ) } </fmt:formatNumber>
and in Tomcat 6.0.13 it works fine. However in Tomcat 5.0.19 the page stops proccessing and and exception is thrown. Tomcat complains that he cannot convert String '-' to a java.lang.Double. I tried to change the code a little to this: <c:choose> <c:when test = "${ road_assistance_2year == '-' }"> <c:set var = "road_assist_price" value = "0.0" /> </c:when> <c:otherwise> <c:set var = "road_assist_price" value = "${ road_assistance_2year }" /> </c:otherwise> </c:choose> and later on just do ${ table_data.package_price + road_assist_price + insured_price } but I still get the same error. Why can't Tomcat just fail the test in when and is there a work around? PS. Yes road_assistance_2year can either be a price, or a '-' indicating N/A.
signature.asc
Description: OpenPGP digital signature