af converter does not work with managed bean attribute

If you have a UI component ,  for example output text ,binned  managed bean attribute  and you want to format the output of this attribute in a decimal format for example, then you have to do this within the managed bean it self.

Example:
if you have an  output text that its value is a managed bean attribute  and you insert inside this output text a converter to convert the output to decimal format ,this will not work.

so the solution is to format the value within the managed bean class , like this

    public void setPaidAmountBase(String paidAmountBase) {
        this.paidAmountBase = paidAmountBase;
    }

    public String getPaidAmountBase() {
        DecimalFormat df = new DecimalFormat("##,###.000");      
        System.out.println(df.format(new BigDecimal(paidAmountBase==null?"0":paidAmountBase)));
        return df.format(new BigDecimal(paidAmountBase==null?"0":paidAmountBase));
   }

Comments

Popular posts from this blog

Another user has changed the row with primary key oracle.jbo.Key[12 ].

Working With File Throgh WebUtill

weblogic windows JPS-01050: Opening of wallet based credential store failed. Reason java.io.IOException: Failed to lock cwallet.sso.lck