Re: Form and PageParameters
t; > >> > On Mon, Sep 7, 2009 at 11:38 AM, Charles Moulliard > >> > wrote: > >> > > >> >> Hi, > >> >> > >> >> I have created a "RequestPage" html page containing a form (= search > >> >> criteria) and a list (= Data View where the result set of data > >> retrieved > >> >> in > >> >> a DB according to search criteria is displayed). When the user clicks > >> on > >> >> the > >> >> "search criteria" button of this page, the request is redirected to > >> the > >> >> RequestPage where we extract the search criteria values and pass them > >> to > >> >> the > >> >> service in charge to retrieve the data. In the java class > accompagning > >> >> this > >> >> page, I have overrided the onSubmit method of the "submit button" to > >> pass > >> >> the value of the form fields > >> >> > >> >>public RequestPage(final PageParameters parameters) { > >> >> ... > >> >> Form form = new Form("searchCriteriaRequest"); > >> >> > >> >>// Add fields > >> >>fRequestId = new TextField("fRequestId", new Model("")); > >> >>fFileName = new TextField("fFileName", new Model("")); > >> >>form.add(fRequestId); > >> >>form.add(fFileName); > >> >> > >> >>// Add buttons > >> >>button = new Button("button") { > >> >>@Override > >> >>public void onSubmit() { > >> >>parameters.add("requestId", fRequestId.getValue()); > >> >>parameters.add("fileName", fFileName.getValue()); > >> >>setResponsePage(RequestPage.class, parameters); > >> >>} > >> >>}; > >> >>form.add(button); > >> >>add(form); > >> >> > >> >> In the constructor of this RequestPage, I call a populate method with > >> >> PageParameters > >> >> > >> >>// Populate list with search criteria values > >> >> populateList(parameters.getKey("requestId"), > >> >> parameters.getKey("fileName")); > >> >> > >> >> Questions : > >> >> 1) Is it the good way to handle PageParameters and Form in Wicket ? > If > >> >> this > >> >> is not the case, can someone point me to a good example ? > >> >> 2) The fields filled in the previous post of my page are not removed > >> when > >> >> I > >> >> repost a new request on my page. How can I reset these fields from > the > >> >> request of the new post ? > >> >> > >> >> Regards, > >> >> > >> >> Charles Moulliard > >> >> Senior Enterprise Architect > >> >> Apache Camel Committer > >> >> > >> >> * > >> >> blog : http://cmoulliard.blogspot.com > >> >> > >> > > >> > > >> > - > >> > Eyal Golan > >> > egola...@gmail.com > >> > > >> > Visit: JVDrums > >> > LinkedIn: LinkedIn > >> > > >> > >> > >> - > >> Charles Moulliard > >> SOA Architect > >> > >> My Blog : http://cmoulliard.blogspot.com/ > >> http://cmoulliard.blogspot.com/ > >> -- > >> View this message in context: > >> http://www.nabble.com/Form-and-PageParameters-tp25326933p25328647.html > >> Sent from the Wicket - User 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 > >> > >> > > > > > > - > > Eyal Golan > > egola...@gmail.com > > > > Visit: JVDrums > > LinkedIn: LinkedIn > > > > > - > Charles Moulliard > SOA Architect > > My Blog : http://cmoulliard.blogspot.com/ http://cmoulliard.blogspot.com/ > -- > View this message in context: > http://www.nabble.com/Form-and-PageParameters-tp25326933p25330634.html > Sent from the Wicket - User 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 > >
Re: Form and PageParameters
eriaRequest"); >> >> >> >>// Add fields >> >>fRequestId = new TextField("fRequestId", new Model("")); >> >>fFileName = new TextField("fFileName", new Model("")); >> >>form.add(fRequestId); >> >>form.add(fFileName); >> >> >> >>// Add buttons >> >>button = new Button("button") { >> >>@Override >> >>public void onSubmit() { >> >>parameters.add("requestId", fRequestId.getValue()); >> >>parameters.add("fileName", fFileName.getValue()); >> >>setResponsePage(RequestPage.class, parameters); >> >>} >> >>}; >> >>form.add(button); >> >>add(form); >> >> >> >> In the constructor of this RequestPage, I call a populate method with >> >> PageParameters >> >> >> >>// Populate list with search criteria values >> >>populateList(parameters.getKey("requestId"), >> >> parameters.getKey("fileName")); >> >> >> >> Questions : >> >> 1) Is it the good way to handle PageParameters and Form in Wicket ? If >> >> this >> >> is not the case, can someone point me to a good example ? >> >> 2) The fields filled in the previous post of my page are not removed >> when >> >> I >> >> repost a new request on my page. How can I reset these fields from the >> >> request of the new post ? >> >> >> >> Regards, >> >> >> >> Charles Moulliard >> >> Senior Enterprise Architect >> >> Apache Camel Committer >> >> >> >> * >> >> blog : http://cmoulliard.blogspot.com >> >> >> > >> > >> > - >> > Eyal Golan >> > egola...@gmail.com >> > >> > Visit: JVDrums >> > LinkedIn: LinkedIn >> > >> >> >> - >> Charles Moulliard >> SOA Architect >> >> My Blog : http://cmoulliard.blogspot.com/ >> http://cmoulliard.blogspot.com/ >> -- >> View this message in context: >> http://www.nabble.com/Form-and-PageParameters-tp25326933p25328647.html >> Sent from the Wicket - User 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 >> >> > > > - > Eyal Golan > egola...@gmail.com > > Visit: JVDrums > LinkedIn: LinkedIn > - Charles Moulliard SOA Architect My Blog : http://cmoulliard.blogspot.com/ http://cmoulliard.blogspot.com/ -- View this message in context: http://www.nabble.com/Form-and-PageParameters-tp25326933p25330634.html Sent from the Wicket - User 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
Re: Form and PageParameters
;>populateList(parameters.getKey("requestId"), > >> parameters.getKey("fileName")); > >> > >> Questions : > >> 1) Is it the good way to handle PageParameters and Form in Wicket ? If > >> this > >> is not the case, can someone point me to a good example ? > >> 2) The fields filled in the previous post of my page are not removed > when > >> I > >> repost a new request on my page. How can I reset these fields from the > >> request of the new post ? > >> > >> Regards, > >> > >> Charles Moulliard > >> Senior Enterprise Architect > >> Apache Camel Committer > >> > >> * > >> blog : http://cmoulliard.blogspot.com > >> > > > > > > - > > Eyal Golan > > egola...@gmail.com > > > > Visit: JVDrums > > LinkedIn: LinkedIn > > > > > - > Charles Moulliard > SOA Architect > > My Blog : http://cmoulliard.blogspot.com/ http://cmoulliard.blogspot.com/ > -- > View this message in context: > http://www.nabble.com/Form-and-PageParameters-tp25326933p25328647.html > Sent from the Wicket - User 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 > >
Re: Form and PageParameters
Add fields >>>> fRequestId = new TextField("fRequestId", new Model("")); >>>> fFileName = new TextField("fFileName", new Model("")); >>>> form.add(fRequestId); >>>> form.add(fFileName); >>>> >>>> // Add buttons >>>> button = new Button("button") { >>>> �...@override >>>> public void onSubmit() { >>>> parameters.add("requestId", fRequestId.getValue()); >>>> parameters.add("fileName", fFileName.getValue()); >>>> setResponsePage(RequestPage.class, parameters); >>>> } >>>> }; >>>> form.add(button); >>>> add(form); >>>> >>>> In the constructor of this RequestPage, I call a populate method with >>>> PageParameters >>>> >>>> // Populate list with search criteria values >>>> populateList(parameters.getKey("requestId"), >>>> parameters.getKey("fileName")); >>>> >>>> Questions : >>>> 1) Is it the good way to handle PageParameters and Form in Wicket ? If >>>> this >>>> is not the case, can someone point me to a good example ? >>>> 2) The fields filled in the previous post of my page are not removed >>>> when >>>> I >>>> repost a new request on my page. How can I reset these fields from the >>>> request of the new post ? >>>> >>>> Regards, >>>> >>>> Charles Moulliard >>>> Senior Enterprise Architect >>>> Apache Camel Committer >>>> >>>> * >>>> blog : http://cmoulliard.blogspot.com >>>> >>> >>> >>> - >>> Eyal Golan >>> egola...@gmail.com >>> >>> Visit: JVDrums >>> LinkedIn: LinkedIn >>> >> >> >> - >> Charles Moulliard >> SOA Architect >> >> My Blog : http://cmoulliard.blogspot.com/ >> http://cmoulliard.blogspot.com/ >> -- >> View this message in context: >> http://www.nabble.com/Form-and-PageParameters-tp25326933p25328647.html >> Sent from the Wicket - User 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 >> >> > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > > > - Charles Moulliard SOA Architect My Blog : http://cmoulliard.blogspot.com/ http://cmoulliard.blogspot.com/ -- View this message in context: http://www.nabble.com/Form-and-PageParameters-tp25326933p25329381.html Sent from the Wicket - User 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
Re: Form and PageParameters
you can call YourForm.this.getModelObject() in your forms onSubmit or the buttons onSubmit method. that would return the model object bound to your CompoundPropertyModel and you model object would have all the updated values -dipu On Mon, Sep 7, 2009 at 11:58 AM, cmoulliard wrote: > > Thx for the reply. > > You are right, it is not a must to use PageParameters but as this is my > first Wicket project, I have started to work with simple things. > > In the meantime, I have had a look to the formInput example where a > CompoundPropertyModel is used. I have adapted the Form to work with it. > > My question is now : > > When I call the first time my page, the url is : http://localhost/request. > Wicket receives this request and the constructor RequestPage(PageParameter > pageParameter) is called. Next, after filling my form in the page and > clicking on the onSubmit button, the request is submitted to the same page. > > How can I retrieve the values of the CompoundPropertyModel from my form in > this case ? Do I have to do something particular in the > setResponsePage(RequestPage.Class) to pass the compoundPropertyModel ? Do I > need to create two different constructors : one for PageParameters and the > other to handle CompoundPropertyModel ? > > Regards, > > Charles > > > egolan74 wrote: >> >> Is it a must that you use PageParameters for RequestPage? >> Do you need an access to it also from a URL (after mounting it in your >> Application). >> >> I think that a nicer way is to add a constructor that accepts the values. >> Even better, I would have created a POJO model. >> Use a CompoundPropertyModel with the form, and pass this object to the >> RequestPage. >> >> Eyal Golan >> egola...@gmail.com >> >> Visit: http://jvdrums.sourceforge.net/ >> LinkedIn: http://www.linkedin.com/in/egolan74 >> >> P Save a tree. Please don't print this e-mail unless it's really >> necessary >> >> >> On Mon, Sep 7, 2009 at 11:38 AM, Charles Moulliard >> wrote: >> >>> Hi, >>> >>> I have created a "RequestPage" html page containing a form (= search >>> criteria) and a list (= Data View where the result set of data retrieved >>> in >>> a DB according to search criteria is displayed). When the user clicks on >>> the >>> "search criteria" button of this page, the request is redirected to the >>> RequestPage where we extract the search criteria values and pass them to >>> the >>> service in charge to retrieve the data. In the java class accompagning >>> this >>> page, I have overrided the onSubmit method of the "submit button" to pass >>> the value of the form fields >>> >>> public RequestPage(final PageParameters parameters) { >>> ... >>> Form form = new Form("searchCriteriaRequest"); >>> >>> // Add fields >>> fRequestId = new TextField("fRequestId", new Model("")); >>> fFileName = new TextField("fFileName", new Model("")); >>> form.add(fRequestId); >>> form.add(fFileName); >>> >>> // Add buttons >>> button = new Button("button") { >>> �...@override >>> public void onSubmit() { >>> parameters.add("requestId", fRequestId.getValue()); >>> parameters.add("fileName", fFileName.getValue()); >>> setResponsePage(RequestPage.class, parameters); >>> } >>> }; >>> form.add(button); >>> add(form); >>> >>> In the constructor of this RequestPage, I call a populate method with >>> PageParameters >>> >>> // Populate list with search criteria values >>> populateList(parameters.getKey("requestId"), >>> parameters.getKey("fileName")); >>> >>> Questions : >>> 1) Is it the good way to handle PageParameters and Form in Wicket ? If >>> this >>> is not the case, can someone point me to a good example ? >>> 2) The fields filled in the previous post of my page are not removed when >>> I >>> repost a new request on my page. How can I reset these fields from the >>> request of the new post ? >>> >>> Regards, >>> >>> Charles Moulliard >>> Senior Enterprise Architect >>> Apache Camel Committer >>> >>> * >>> blog : http://cmoulliard.blogspot.com >>> >> >> >> - >> Eyal Golan >> egola...@gmail.com >> >> Visit: JVDrums >> LinkedIn: LinkedIn >> > > > - > Charles Moulliard > SOA Architect > > My Blog : http://cmoulliard.blogspot.com/ http://cmoulliard.blogspot.com/ > -- > View this message in context: > http://www.nabble.com/Form-and-PageParameters-tp25326933p25328647.html > Sent from the Wicket - User 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 > > - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Form and PageParameters
Thx for the reply. You are right, it is not a must to use PageParameters but as this is my first Wicket project, I have started to work with simple things. In the meantime, I have had a look to the formInput example where a CompoundPropertyModel is used. I have adapted the Form to work with it. My question is now : When I call the first time my page, the url is : http://localhost/request. Wicket receives this request and the constructor RequestPage(PageParameter pageParameter) is called. Next, after filling my form in the page and clicking on the onSubmit button, the request is submitted to the same page. How can I retrieve the values of the CompoundPropertyModel from my form in this case ? Do I have to do something particular in the setResponsePage(RequestPage.Class) to pass the compoundPropertyModel ? Do I need to create two different constructors : one for PageParameters and the other to handle CompoundPropertyModel ? Regards, Charles egolan74 wrote: > > Is it a must that you use PageParameters for RequestPage? > Do you need an access to it also from a URL (after mounting it in your > Application). > > I think that a nicer way is to add a constructor that accepts the values. > Even better, I would have created a POJO model. > Use a CompoundPropertyModel with the form, and pass this object to the > RequestPage. > > Eyal Golan > egola...@gmail.com > > Visit: http://jvdrums.sourceforge.net/ > LinkedIn: http://www.linkedin.com/in/egolan74 > > P Save a tree. Please don't print this e-mail unless it's really > necessary > > > On Mon, Sep 7, 2009 at 11:38 AM, Charles Moulliard > wrote: > >> Hi, >> >> I have created a "RequestPage" html page containing a form (= search >> criteria) and a list (= Data View where the result set of data retrieved >> in >> a DB according to search criteria is displayed). When the user clicks on >> the >> "search criteria" button of this page, the request is redirected to the >> RequestPage where we extract the search criteria values and pass them to >> the >> service in charge to retrieve the data. In the java class accompagning >> this >> page, I have overrided the onSubmit method of the "submit button" to pass >> the value of the form fields >> >>public RequestPage(final PageParameters parameters) { >> ... >> Form form = new Form("searchCriteriaRequest"); >> >>// Add fields >>fRequestId = new TextField("fRequestId", new Model("")); >>fFileName = new TextField("fFileName", new Model("")); >>form.add(fRequestId); >>form.add(fFileName); >> >>// Add buttons >>button = new Button("button") { >>@Override >>public void onSubmit() { >>parameters.add("requestId", fRequestId.getValue()); >>parameters.add("fileName", fFileName.getValue()); >>setResponsePage(RequestPage.class, parameters); >>} >>}; >>form.add(button); >>add(form); >> >> In the constructor of this RequestPage, I call a populate method with >> PageParameters >> >>// Populate list with search criteria values >>populateList(parameters.getKey("requestId"), >> parameters.getKey("fileName")); >> >> Questions : >> 1) Is it the good way to handle PageParameters and Form in Wicket ? If >> this >> is not the case, can someone point me to a good example ? >> 2) The fields filled in the previous post of my page are not removed when >> I >> repost a new request on my page. How can I reset these fields from the >> request of the new post ? >> >> Regards, >> >> Charles Moulliard >> Senior Enterprise Architect >> Apache Camel Committer >> >> * >> blog : http://cmoulliard.blogspot.com >> > > > - > Eyal Golan > egola...@gmail.com > > Visit: JVDrums > LinkedIn: LinkedIn > - Charles Moulliard SOA Architect My Blog : http://cmoulliard.blogspot.com/ http://cmoulliard.blogspot.com/ -- View this message in context: http://www.nabble.com/Form-and-PageParameters-tp25326933p25328647.html Sent from the Wicket - User 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
Re: Form and PageParameters
Is it a must that you use PageParameters for RequestPage? Do you need an access to it also from a URL (after mounting it in your Application). I think that a nicer way is to add a constructor that accepts the values. Even better, I would have created a POJO model. Use a CompoundPropertyModel with the form, and pass this object to the RequestPage. Eyal Golan egola...@gmail.com Visit: http://jvdrums.sourceforge.net/ LinkedIn: http://www.linkedin.com/in/egolan74 P Save a tree. Please don't print this e-mail unless it's really necessary On Mon, Sep 7, 2009 at 11:38 AM, Charles Moulliard wrote: > Hi, > > I have created a "RequestPage" html page containing a form (= search > criteria) and a list (= Data View where the result set of data retrieved in > a DB according to search criteria is displayed). When the user clicks on > the > "search criteria" button of this page, the request is redirected to the > RequestPage where we extract the search criteria values and pass them to > the > service in charge to retrieve the data. In the java class accompagning this > page, I have overrided the onSubmit method of the "submit button" to pass > the value of the form fields > >public RequestPage(final PageParameters parameters) { > ... > Form form = new Form("searchCriteriaRequest"); > >// Add fields >fRequestId = new TextField("fRequestId", new Model("")); >fFileName = new TextField("fFileName", new Model("")); >form.add(fRequestId); >form.add(fFileName); > >// Add buttons >button = new Button("button") { >@Override >public void onSubmit() { >parameters.add("requestId", fRequestId.getValue()); >parameters.add("fileName", fFileName.getValue()); >setResponsePage(RequestPage.class, parameters); >} >}; >form.add(button); >add(form); > > In the constructor of this RequestPage, I call a populate method with > PageParameters > >// Populate list with search criteria values >populateList(parameters.getKey("requestId"), > parameters.getKey("fileName")); > > Questions : > 1) Is it the good way to handle PageParameters and Form in Wicket ? If this > is not the case, can someone point me to a good example ? > 2) The fields filled in the previous post of my page are not removed when I > repost a new request on my page. How can I reset these fields from the > request of the new post ? > > Regards, > > Charles Moulliard > Senior Enterprise Architect > Apache Camel Committer > > * > blog : http://cmoulliard.blogspot.com >
Form and PageParameters
Hi, I have created a "RequestPage" html page containing a form (= search criteria) and a list (= Data View where the result set of data retrieved in a DB according to search criteria is displayed). When the user clicks on the "search criteria" button of this page, the request is redirected to the RequestPage where we extract the search criteria values and pass them to the service in charge to retrieve the data. In the java class accompagning this page, I have overrided the onSubmit method of the "submit button" to pass the value of the form fields public RequestPage(final PageParameters parameters) { ... Form form = new Form("searchCriteriaRequest"); // Add fields fRequestId = new TextField("fRequestId", new Model("")); fFileName = new TextField("fFileName", new Model("")); form.add(fRequestId); form.add(fFileName); // Add buttons button = new Button("button") { @Override public void onSubmit() { parameters.add("requestId", fRequestId.getValue()); parameters.add("fileName", fFileName.getValue()); setResponsePage(RequestPage.class, parameters); } }; form.add(button); add(form); In the constructor of this RequestPage, I call a populate method with PageParameters // Populate list with search criteria values populateList(parameters.getKey("requestId"), parameters.getKey("fileName")); Questions : 1) Is it the good way to handle PageParameters and Form in Wicket ? If this is not the case, can someone point me to a good example ? 2) The fields filled in the previous post of my page are not removed when I repost a new request on my page. How can I reset these fields from the request of the new post ? Regards, Charles Moulliard Senior Enterprise Architect Apache Camel Committer * blog : http://cmoulliard.blogspot.com