zwwcn

Just another WordPress.com site

Monthly Archives: October 2012

java.lang.ArithmeticException: Non-terminating decimal expansion; no exact representable decimal result

Exception:

java.lang.ArithmeticException: Non-terminating decimal expansion; no exact representable decimal result.
solution: add precision and rounding model

amount.divide(b, 2, RoundingMode.HALF_UP)
Advertisements

jsf popup panel validation

Around the content with s:validateAll tag, and then add oncomplete attribute on the save button.

<a4j:commandButton oncomplete=”if (#{facesContext.maximumSeverity == null}){Richfaces.hideModalPanel(‘trackingFieldPanel’)}”/>
If there’s any validation error, the window will stay open.