Java – Multiple TextFields in a Wicket form

Multiple TextFields in a Wicket form… here is a solution to the problem.

Multiple TextFields in a Wicket form


have a bean that I attach to the form using a model and it works fine. I also have a field in the bean like Map<String, javax.mail.Address> Considering that every map entry should look like Label: TextField, how do I bind this field to a form via a model?

Thanks in advance.


Maybe something like this:

ListView<String> textAreasListView = new ListView<String>("someid", {
    protected void populateItem(final ListItem<String> itemLang) {
        itemLang.add(new Label("label", itemLang.getModelObject()));
        Model<String> textModel = new Model<String>() {

            public String getObject() {

            public void setObject(String object) {
      , new Address(object));
        itemLang.add(new TextField<String>("email", textModel));

and add it to your form.

Custom converters for addresses and strings will be an additional improvement.

Related Problems and Solutions