final TextField<Integer> field = new TextField<Integer>("textfield",
new PropertyModel<Integer>(this, "number"));
field.add(new MaximumValidator<Integer>(20));
field.setRequired(true);
StatelessForm<?> statelessForm = new StatelessForm("statelessform")
{
/**
* @see org.apache.wicket.markup.html.form.Form#onSubmit()
*/
@Override
protected void onSubmit()
{
info("Submitted text: " + field.getDefaultModelObject());
// store the value in page parameters
getPage().getPageParameters().setNamedParameter(PARAMETER_NAME, number);
// force redirect, otherwise the listener interface URL would be kept
getRequestCycle().setResponsePage(getPage());
}
};
statelessForm.add(field);
add(statelessForm);
add(new FeedbackPanel("feedback"));
}