views:

29

answers:

0

I am using Spring MVC as a front-end to my Spring app. I have an object which is put into the model, which contains all of the values for my report. It looks like this:

public class AggregateResultBean {

 private String regionName;
 private String countryName;
 private String indicatorId;

 @NumberFormat(pattern="#,###,###.00")
 private HashMap<String, BigDecimal> indicatorValues;

     .
     .
     .
}

In my jsp, I loop over a list of months, like Jan97, Feb97, etc, that are the keys to the indicatorValues hashmap above, and I get the indicatorValue for a specific month.

I want to format that value, but the above code is not doing the trick.

The second, more complicated part is that I want the numberFormatter to be a Percent Formatter when, say, indicatorId = 5 or something. How would I go about doing this using annotations (or even without annotations)?