Hello Martin, Of course, clear answer! Thanks a lot. Gerrit
Martin Grigorov <mgrigo...@apache.org> , 26-11-2013 16:12: Hi, redirect_to_** strategies saves you from re-submitting a form by using F5/Refresh buttons. There is no logic in Wicket that will prevent you to click on a submit button second time. You can move to another page or set an empty model to the form so it shows empty. On Tue, Nov 26, 2013 at 5:06 PM, gerritqf <gerrit.wass...@qfactors.nl>wrote: > Hello, > > In my quickstart wicket application in Eclipse with Jetty server in debug > mode i have added a wicket form within a webpage. > Now when i submit the wicket form an object is written into the database. > After this the form is displayed again with the inputvalue in the > textfield. > Is'n it a default setting in Wicket that the page cannot submitted twice > because of "Redirect to buffer" setting? > But in my example it is possible to accidentally resubmit the same value. > Is there an obvious explanation? > > Code for the wicket page: > =============================================== > public class BedrijfPage extends WebPage { > > private static final long serialVersionUID = 1L; > private Form<?> form; > private TextField<String> bedrijf; > private Label message; > > public BedrijfPage() { > this.bedrijf = new TextField<String>("bedrijf", Model.of("")); > this.message = new Label("message", Model.of("")); > this.form = new Form("form") { > > @Override > public void onSubmit() { > System.out.println("onSubmit"); > String bedrijfsnaam = (String) bedrijf.getDefaultModelObject(); > // wegschrijven naar database > if (bedrijfsnaam == null) { > message.setDefaultModelObject("Het veld bedrijf is niet > ingevuld!"); > } > else { > Bedrijf bedrijf = new Bedrijf(); > bedrijf.setNaam(bedrijfsnaam); > try { > PuqBeheer.getInstance().addBedrijf(bedrijf); > message > .setDefaultModelObject("Het bedrijf is toegevoegd aan de > database"); > } > catch (SysteemException se) { > message.setDefaultModelObject(se.getMessage()); > } > } > } > }; > > this.add(form); > form.add(bedrijf); > form.add(message); > } > > } > > ===================================================== > Code htmlpage > ===================================================== > > <!DOCTYPE html> > <html xmlns:wicket="http://wicket.apache.org"> > <head> > <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> > <title>Toevoegen bedrijf aan Puq</title> > </head> > <body> > <form id="form" wicket:id="form"> > Naam Bedrijf:<input wicket:id="bedrijf" type="text" > id="bedrijf"> > <br /> > <input type="submit" name="submit" value="Submit"> > > </form> > > </body> > </html> > ===================================================== > > > > > > -- > View this message in context: > http://apache-wicket.1842946.n4.nabble.com/Redirect-to-buffer-does-not-work-tp4662681.html > > Sent from the Users forum mailing list archive at Nabble.com. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > >