开发者

Spring Binding issue

I have some objects like the two below

public class SavedSearch {
String title;
ArrayList<SearchP开发者_Python百科arameters> params;
}

public class SearchParameter {
String field;
int operator;
String match;
}

On the JSP page in the input form, I use

<input type="text" name="title">

and when I breakpoint inside the FormController, the SavedSearch object has title filled in.

But the ArrayList is always empty. It's not Spring's fault that it can't read my mind, but how do I indicate that field, operator and match are part of params? I tried naming them paramsField, paramsOperator, paramsMatch but no luck.

I know this is not a hard question, but I'm a bit stumped.


for binding a List you must use special wrapper instead of ArrayList: AutoPopulatingList from Spring or LazyList from Apache Commons Collections.

some examples:

using LazyList

using AutoPopulatingList

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜