try using setResponsePage(TestPage.this); the way you did is results in a redirect to a new instance of TestPage
regards, Michael pixologe wrote: > > Hi everybody, > > This may be an idiot question, but no matter how many articles and > examples I read about this, I seem not to be able to grasp how to use > DropDownChoice with PropertyModel. > > I would very very highly appreciate if someone could point out to me why > the code below is not working as I expect it to do: > > What I expect to happen: when selecting value "3" from the DropDownChoice, > the page reloads, having "3" selected. > What happens: the page reloads, having "2" selected again (which is > assigned by default). > > I would be happy for any hint on this... Thanks in advance > > Here comes the code for the page: > > ------------------------------------------------------ > package de.lovelybooks3.presentation; > > import java.util.Arrays; > import org.apache.wicket.markup.html.WebPage; > import org.apache.wicket.markup.html.form.DropDownChoice; > import org.apache.wicket.markup.html.form.Form; > import org.apache.wicket.model.PropertyModel; > > > > public class TestPage extends WebPage { > > private String testvalue = "2"; > public String getTestvalue() { > return testvalue; > } > public void setTestvalue(String testvalue) { > this.testvalue = testvalue; > } > > public TestPage() { > > Form f = new Form("testform"); > add(f); > DropDownChoice d = new DropDownChoice("testselect", new > PropertyModel(this,"testvalue"), Arrays.asList(new String[]{"1","2","3"})) > { > @Override > protected void onSelectionChanged(Object arg0) { > setResponsePage(getPageClass()); > } > @Override > protected boolean wantOnSelectionChangedNotifications() { > return true; > } > }; > f.add(d); > } > } > > --------------------------------------------------- > <html> > <head> > </head> > <body> > <form wicket:id="testform"> > <select wicket:id="testselect"></select> > </form> > </body> > </html> > ----- Michael Sparer http://talk-on-tech.blogspot.com -- View this message in context: http://www.nabble.com/DropDownChoice%2C-PropertyModel-and-stateful-pages-tp18606819p18607288.html Sent from the Wicket - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]