Many thanks for your help.

With the modifications you propose, everything works fine

Here is what I changed in the onSubmit method of the button

public void onSubmit() {
 setResponsePage(new RequestPage((RequestModel)
this.getForm().getModelObject()));
}

Question : Do I have need to duplicate the code between the two constructors
? I mean Do I need to have in double ?

        final FeedbackPanel feedback = new FeedbackPanel("feedback");
        add(feedback);
        RequestForm requestForm = new RequestForm("requestForm");
        add(requestForm);
        .....


egolan74 wrote:
> 
> You can have two constructors in your page.
> If you work 'internally' then you can use the one that accepts a pojo. If
> you work with URL, then the one that accepts PageParameters will be used.
> 
> the setResponsePage can accept a Page and not only a class, so what you
> can
> do is create your page: new RequestPage(myPojoModelObject), and then put
> it
> in the setResponsePage parameter.
> 
> IllegalArgumentException: A child with id 'requestList' already
> means that you added it already to your page. AFAICS you don't go to a new
> page in the button submit so you add the list over and over again.
> 
> if you want to update a list, use a dynamic model for the content and
> update
> it.
> 
> 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 1:58 PM, cmoulliard <cmoulli...@gmail.com> 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
>> > <cmoulli...@gmail.com>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

Reply via email to