We have a Spring binding which is converting strings to List
s, using default converters available with Spring.
For example if we have a, b, c
pushed from the form then the controller gets a List
with elements:
- a
- b
- c
We don't have to do anything special in our code.
I have a problem dealing with commas in my data. If I submit a, x,z, b , c
here x,z
is actually a single String, but the Spring converter does not know that and assumes that it's a delimiter and makes up the List
like this:
- a
- x
- y
- b
- c
Now I come to my questions:
- Can I escape
,
(comma) in my data when submitting the form? - If I have to register a custom converter, will I affect the default behavior for specific data character escaping?
- Can I control the order of converters?
- How do I tell my converter to pick up for this kind of data alone ?
- If I have to create a custom converter, can I have a custom annotation to say that my converter should work for only the fields that got my annotation?