Hi,
I'm using a Converter from String to Product which I can use to automatically load products from database using a name and receive them in my controller methods:
Now, I've got a form with a select drop-down and I need to bind products from that. But here I can't use the product name as before, and I must use the product identifier (an integer) for binding. And although this id is a number, the form will submit a string, so the converter needs to be, again, from String to Product. So I would end up with two Converter<String, Product>, which is a conflict.Code:@RequestMapping("/product/{name}") public void viewProduct(@PathVariable("name") Product product) { ... }
Is there a solution for this? I know I could parse the string inside the converter to see if it's a name or a number, but I feel this is not a good approach.
Thanks in advance.


Reply With Quote
