tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dimitris Mouchritsas <...@mail.daedalus.gr>
Subject EL Expressions allowed with Tomcat 5.0.19
Date Tue, 07 Aug 2007 12:37:19 GMT
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.






Mime
View raw message