setResponsePage(getPage().getClass()) is what you do wrong. This tells
wicket to render a bookmarkable response to your page -> creates the
page again.
remove that call and it should work.
Martijn
On Wed, Jul 23, 2008 at 11:16 AM, pixologe <[EMAIL PROTECTED]> 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>
> --
> View this message in context:
> http://www.nabble.com/DropDownChoice%2C-PropertyModel-and-stateful-pages-tp18606819p18606819.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]
>
>
--
Become a Wicket expert, learn from the best: http://wicketinaction.com
Apache Wicket 1.3.4 is released
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]