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
>

Reply via email to