There is an error in el-1.0 used by jsf 1.1 that converts BigDecimal to double and then back to BigDecimal during the update model phase. This happens in the class ELSupport.java → coerceToNumber and is fixed in el-impl-2.1.2-b03. The end result is that if the user enters 54.93, then this leads to 54.92999999 ... when the updateModel step occurs.
Suppose that I do not have the opportunity to upgrade to el-2.1.2-b03, but I still have to guarantee the accuracy of my calculations and what I send to the server. What is the best rounding strategy? I thought of simply setting the scale to 2 using the ROUND_HALF_EVEN rounding strategy whenever the setter method is called in my bean support during the updateModel phase.
Is there a better solution?
source
share