PDA

View Full Version : Comma in field after binding


p3t0r
May 31st, 2006, 11:27 AM
If I have multiple request parameters using the same name binding them to a string property results in a CSV string.... i.e:

// setup mock request
MockHttpServletRequest request = new MockHttpServletRequest();
// parent params
request.addParameter("text", "a");
request.addParameter("text", "b");
request.addParameter("text", "c");

results in the text property having a value of "a,b,c"

Nice, but unwanted... is it possible to change this behaviour?

Mark Fisher
May 31st, 2006, 01:23 PM
A call to request.getParameterValues("text") returns a String array with "a", "b", and "c" as its 3 elements. The String array is being converted to a comma-delimited String since the target property is a String. One option would be to change the property to be a String array.

Can you describe what behaviour you do want?

p3t0r
May 31st, 2006, 03:37 PM
Yeah I just noticed...! the problem was that someone accidently broke binding duplicating one of the formfields... I also noticed the fact that the array editor features configuration for the seperator sign.. sweet!

Thanks anyway!