Spring MVC
@InitBinder private void customizeBinding (@PathVariable("tradeId") long tradeId, WebDataBinder binder) { Trade trade = tradeService.getTradeById(tradeId); if (trade == null) { return; } CurrencyStyleFormatter currencyFormatter = new CurrencyStyleFormatter(); currencyFormatter.setCurrency( "Buy".equals(trade.getBuySell()) ? trade.getBuyCurrency() : trade .getSellCurrency()); binder.addCustomFormatter(currencyFormatter, "amount"); }