|
From: Kopylenko, D. <dko...@ac...> - 2003-03-24 15:56:26
|
Hello everyone. I have a question about the Spring's data binding framework.
Let's say I have a simple bean with the String[] property like
public class ProgramRequest() {
private String[] programs;
public void setPrograms(String[] programs)...
public String[] getPrograms()....
...
}
And then I have HTML form with elements like this:
<select name="programs" id="programs" tabindex="2" multiple="multiple"
size="6" style="width:99%">
<option value="1">Program 1</option>
<option value="2">Program 2</option>
<option value="3">Program 3</option>
</select>
I'd like to bind these multiple params onto String[] property of the bean
using the Spring's DataBinder:
...
ProgramRequest programRequest = new ProgramRequest();
ServletRequestDataBinder programRequestBinder =
new ServletRequestDataBinder(programRequest,
"programRequest");
programRequestBinder.bind(request);
...
but it doesn't work (programs property is null after the bind() call).
However, manual binding does work:
programRequest.setPrograms(request.getParameterValues("programs"));
What am I missing?
Thanks,
Dmitriy.
|