求百分比


c=a/b:

if("0".equals(a){
c = new BigDecimal(0);
}else{
       c= new BigDecimal(a*100).divide(new BigDecimal(b),BigDecimal.ROUND_HALF_UP);
}

js:
<script type="text/javascript">document.write(divide(<s:property value="#data[1]" />, <s:property value="#data[2]" />));</script>


你可能感兴趣的:(求百分比)