Hello Zeldor,
I've red your code and it seems that you define variable rc two times:
the first time as form private field and the second time just below
between braces. When onSubmit method calls rc.getModelObject() it uses
private field rc which was not initialized and so triggers a
NullPointerException. Try to remove the second type definition
"RadioChoice<String>" and it should work.
public class Registration extends WebPage {
public Registration() {
add(new FeedbackPanel("errorMsg"));
//New user registration form
Form<String> regForm = new
Form<String>("registrationForm",new Model<String>()) {
static final List<String> NUMBERS =
Arrays.asList(new String[] { "1", "2", "3" });
private RadioChoice<String> rc;
{
RadioChoice<String> rc = new
RadioChoice<String>("numberRadioChoice", new
Model<String>(""),NUMBERS).setSuffix("");
add(rc.setRequired(true));
}
@Override
public void onSubmit() {
String _numbers = rc.getModelObject();
System.out.println(_numbers);
}
};
add(regForm);
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]