Stack Exchange
Wicket - Appending values to json schema
NewForm.java
public class NewForm extends WebPage {

private Bean bean;
private DropDownClass dropdown;


private String selected = "choice";

void init()
{
    bean = new Bean();
    dropdown=new DropDownClass("test");

}

public NewForm(final PageParameters page) {
    init();



    final TextField<String> textname = new TextField<String>("name",Model.of(""));
    textname.setRequired(true);

    final DropDownChoice<String> dropname = new DropDownChoice<String>("type", new PropertyModel<String>(this, "selected"),
            dropdown.getlist());


    Form<?> form = new Form<Void>("Form") {
        @Override
        public void onSubmit() {

            final String name = (String) textname.getModelObject();
            final String dropdown  = (String)dropname.getModelObject();
             bean.add(name,dropdown);
             final String schema = bean.getJsonSchema().toString();
             page.add("schema", schema);

             setResponsePage(new NewForm(page));

        }           

    };

    Label schemalabel = new Label("schema", page.get("schema"));

    add(form);

    form.add(textname);
    form.add(dropname);
    form.add(schemalabel);  
   }
 }

Bean.java
public class Bean 
{

private JSONObject jsonSchema;

public JSONObject getJsonSchema() {
    return jsonSchema;
}

public void setJsonSchema(JSONObject jsonSchema) {
    this.jsonSchema = jsonSchema;
}

public Bean() {     
    jsonSchema = new JSONObject();
}

public void add(String key,String value)
{    
    jsonSchema.put(key, value); // I am able to append values each time using "put" or "append" in JSF but not in WICKET.How can I append values in Wicket?

    //or jsonSchema.append(key, value); //adding values only once and not appending each time,I enter the values in TextField and DropDown 
}
}

In CreateForm.java - I have a Textfield and DropDown. When I enter the values in TextField and DropDown..I am able to convert the values entered in TextField and DropDown as JSON schema from method add(String key,String value) in AttributeInfo.java and display the schema as - {"name":"abc"} //where name is value entered in TextField and abc is from DropDown.
I am able to display the schema only once onSubmit But I need to append the values to schema each time,I enter in TextField and DropDown onSubmit and display in the samepage.
How can I achieve this in Wicket?
I am just a beginner.Any Help would be appreciated.Thankyou in advance. 

see this tutorial -> link

Thankyou... Can you please provide an example programmatically?

Maybe I don't understand. Divide problem: wicket DropDown, wicket Model (very important), json data (not connected to wicket). I dont know where is main problem.
