i suggest you read here:
http://cwiki.apache.org/confluence/display/WICKET/Working+with+Wicket+models
the idea is pretty simple:
the form submits its data into a bean, and the view renders according to
that bean. this is accomplished by having the form and the view's models
connected to the same bean via models.
-igor
On 4/30/07, Martin Grotzke <[EMAIL PROTECTED]> wrote:
hi igor,
i'm trying to implement your advice, but don't really know
how to do this.
what would the SearchForm then look like? does the form itself
use the model and how is the input field added to the form?
and how can the ResultsView access the value of the PropertyModel?
the model has a getObject(Component) accessor - does this mean that
the ResultsView would need pass the SearchPage into getObject?
thanx && cheers,
martin
On Sun, 2007-04-29 at 18:05 -0700, Igor Vaynberg wrote:
> in reality this isnt how its supposed to work.
>
> usually you would have something like this:
>
> searchpage {
> private criteria crit;
>
> searchpage() {
> add(new searchform("form", new PropertyModel(this, "crit"));
> add(new resultsview("view", new PropertyModel(this, "crit"));
> }
> }
>
> that way the form and the view are bound to the same criteria object.
> the form modifies it, and the view renders according to it. you would
> not call any setresponsepage in the form, the same insatance of the
> page would be reused. that is the wicket way. however, if you must
> have that nice bookmarkable url then you need to call
> setresponsepage(class, pageparams) from the form. it is not as clean,
> but it works.
>
> -igor
>
> On 4/29/07, Martin Grotzke <[EMAIL PROTECTED]> wrote:
> On Sun, 2007-04-29 at 17:41 -0700, Igor Vaynberg wrote:
> > no, once the form is submitted the page is no longer
> bookmarkable and
> > so it will lose any bookmarkable/mounted url.
> >
> > if you want to keep it you can call
> setresponsepage( page.class,
> > params) in onsubmit(), but in your case that is silly since
> > searchresultspage probably contains the submitted form
> anyways?
> well, i can do this (setResponsePage with params).
> the SearchResultsPage indeed has a also an instance of the
> form,
> and the user can also initiate a search on the
> SearchResultsPage.
>
> so for each search the SearchForm.onSubmit creates a new
> SearchResultsPage and (indirectly) a new SearchForm...
>
> i just wonder if this this is the way how wicket should work,
> or if
> this stateless way is s.th. that is not really the target of
> component based frameworks...
>
> thanx && cheers,
> martin
>
>
> >
> > -igor
> >
> >
> > On 4/29/07, Martin Grotzke < [EMAIL PROTECTED]>
> wrote:
> > hi all,
> >
> > i'm just starting with wicket and have a simple
> search
> > form, that leads to a SearchResultsPage.
> >
> > the SearchResultsPage is mounted as a bookmarkable
> page (via
> > mountBookmarkablePage("/search",
> SearchResultsPage.class);),
> > although the url that is shown then contains s.th.
> like
> >
?wicket:interface=:6:searchForm::IFormSubmitListener...
> >
> > is it possible to have a nicer url for the submitted
> form?
> >
> > i'm using wicket 1.2.6 right now...
> >
> > thanx in advance,
> > cheers,
> > martin
> >
> >
> >
> >
>
-------------------------------------------------------------------------
> > This SF.net email is sponsored by DB2 Express
> > Download DB2 Express C - the FREE version of DB2
> express and
> > take
> > control of your XML. No limits. Just data. Click to
> get it
> > now.
> > http://sourceforge.net/powerbar/db2/
> > _______________________________________________
> > Wicket-user mailing list
> > [email protected]
> >
> https://lists.sourceforge.net/lists/listinfo/wicket-user
> >
> >
> >
> >
>
-------------------------------------------------------------------------
> > This SF.net email is sponsored by DB2 Express
> > Download DB2 Express C - the FREE version of DB2 express and
> take
> > control of your XML. No limits. Just data. Click to get it
> now.
> > http://sourceforge.net/powerbar/db2/
> > _______________________________________________ Wicket-user
> mailing list [email protected]
> https://lists.sourceforge.net/lists/listinfo/wicket-user
> --
> Martin Grotzke
> http://www.javakaffee.de/blog/
>
>
-------------------------------------------------------------------------
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and
> take
> control of your XML. No limits. Just data. Click to get it
> now.
> http://sourceforge.net/powerbar/db2/
> _______________________________________________
> Wicket-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/wicket-user
>
>
>
>
-------------------------------------------------------------------------
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> _______________________________________________ Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user
--
Martin Grotzke
http://www.javakaffee.de/blog/
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user