私のSpring Webアプリケーションでは:
@RequestMapping(value = NEW)
public String addProduct(@RequestParam String name, @RequestParam(required = false) String description,
@RequestParam String price, @RequestParam String company, ModelMap model,
@RequestParam(required = false) String volume, @RequestParam(required = false) String weight) {
try {
productManagementService.addNewProduct(name, description, company, price, volume, weight);
model.addAttribute("confirm", PRODUCT_ADDED);
return FORM_PAGE;
} catch (NumberFormatException e) {
logger.log(Level.SEVERE, INVALID_VALUE);
model.addAttribute("error", INVALID_VALUE);
return FORM_PAGE;
} catch (InvalidUserInputException e) {
logger.log(Level.SEVERE, e.getMessage());
model.addAttribute("error", e.getMessage());
return FORM_PAGE;
}
}
引数の総数を減らす/バインドする可能な方法は何ですか。