java - BigDecimal in JSTL, divide by int or double returns integer -
<fmt:formatnumber var="instamount" value="${invoice.amount / offer.gettotalinstallments()}" minfractiondigits="2" /> where amount bigdecimal in java , totalinstallments int. tried setting totalinstallments double nothing changes. returns integer, behaves when divide 2 integers in java, integer.
am missing or there workaround?
the easiest solution calculation in controller/servlet , use result on view page. think calculations should done in controller , not view. use divide() method on bigdecimal.
that said, if want in view have define jstl function in tag library , create static version of divide accepts bigdecimal , int diving by.
Comments
Post a Comment