You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Gabor Szokoli <sz...@gmail.com> on 2007/11/28 21:34:19 UTC

PageParameter backed models?

Hi there,

I'd like to have a search form, which keeps the last submitted search
parameters in PageParameters in a bookmarkable fashion.
I am wondering about the "wicket way" of doing this, and I keep coming
back to an imaginary LoadableDetachableModel variant which would store
a unique key, and load/store its object value from/to the
PageParameters.
I'd appreciate some advice: What would be the nicest way to get hold
of the pageparameters in the current request from a model, and to set
one in the next response?
Or Is there some better way to achieve bookmarkable (partial) form state?


Thanks in advance:

Gabor Szokoli

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: PageParameter backed models?

Posted by Gabor Szokoli <sz...@gmail.com>.
On Dec 21, 2007 2:03 PM, Johan Compagner <jc...@gmail.com> wrote:
>  Look at HybridUrlCodingStrategy and mount the pages with that.

Found that one, thank you!
We'll look at it in detail.

>
> I guess you want them on the url so that the user can bookmark it right?

Exactly.

(You can look at my original-original message multi-quoted on the
bottom of my first mail from today...)


Gabor Szokoli

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: PageParameter backed models?

Posted by Johan Compagner <jc...@gmail.com>.
 Look at HybridUrlCodingStrategy and mount the pages with that.

I guess you want them on the url so that the user can bookmark it right?

johan


On Dec 21, 2007 1:49 PM, Gabor Szokoli <sz...@gmail.com> wrote:

> On Dec 21, 2007 1:09 PM, Johan Compagner <jc...@gmail.com> wrote:
> > maybe you could do setResponsePage(new MyPage())
> > and use HyrbidUrlEncoding for a nice redirect url..
>
> I am unable to find any reference to HyrbidUrlEncoding, could you help
> me out a notch more with a pointer?
> Also, we use the class-based setResponsePage variant because we need
> to set a few page parameters to store some of the state in the URL.
>
>
> Thanks!
>
> Gabor Szokoli
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: PageParameter backed models?

Posted by Gabor Szokoli <sz...@gmail.com>.
On Dec 21, 2007 1:09 PM, Johan Compagner <jc...@gmail.com> wrote:
> maybe you could do setResponsePage(new MyPage())
> and use HyrbidUrlEncoding for a nice redirect url..

I am unable to find any reference to HyrbidUrlEncoding, could you help
me out a notch more with a pointer?
Also, we use the class-based setResponsePage variant because we need
to set a few page parameters to store some of the state in the URL.


Thanks!

Gabor Szokoli

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: PageParameter backed models?

Posted by Johan Compagner <jc...@gmail.com>.
maybe you could do setResponsePage(new MyPage())
and use HyrbidUrlEncoding for a nice redirect url..

johan



On Dec 21, 2007 12:26 PM, Gabor Szokoli <sz...@gmail.com> wrote:

> Hi,
>
> We have been happy with the below suggestion for keeping our search
> criteria in the URL:
>
>  onsubmit() {
>       setresponsepage(searchpage.class, crit.topageparameterrs());
>   };
>
> Now we are beginning to experience the downsides: non-parameter backed
> models on the page (how many rows to display per page for example) get
> lost in this cycle.
>
> Could you guys suggest some in-between approach, where part of the
> state is stored in the URL, but the rest is kept in the components
> (models)?
>
>
> Thanks:
>
> Gabor Szokoli
>
>
> On Nov 28, 2007 9:46 PM, Igor Vaynberg <ig...@gmail.com> wrote:
>  > why not just
> >
> >
> > class searchpage extends webpage {
> >   private PageParameters params;
> >
> >   private criteria crit=new criteria();
> >
> >   public searchpage(pageparameters params) {
> >     this.params=params;
> >
> >   add(new dataview("results", new dataprovider()) {... });
> >
> >   form form=new form("form", new compoundproperty(new
> > propertymodel(this, "crit"))) {
> >    onsubmit() {
> >       setresponsepage(searchpage.class, crit.topageparameterrs());
> >   };
> >   add(form);
> >    form.add(new textfield("name")); ....
> >
> >
> >   }
> >
> >
> >
> >   private class dataprovider implements idataprovider {
> >     public iterator iterator(...) {
> >        return dao.search(params);
> >    } public int size() { return dao.size(params); }
> >   }
> >
> >
> > done
> >
> > -igor
> >
> >
> >
> > On Nov 28, 2007 12:34 PM, Gabor Szokoli <sz...@gmail.com> wrote:
> > > Hi there,
> > >
> > > I'd like to have a search form, which keeps the last submitted search
> > > parameters in PageParameters in a bookmarkable fashion.
> > > I am wondering about the "wicket way" of doing this, and I keep coming
> > > back to an imaginary LoadableDetachableModel variant which would store
> > > a unique key, and load/store its object value from/to the
> > > PageParameters.
> > > I'd appreciate some advice: What would be the nicest way to get hold
> > > of the pageparameters in the current request from a model, and to set
> > > one in the next response?
> > > Or Is there some better way to achieve bookmarkable (partial) form
> state?
> > >
> > >
> > > Thanks in advance:
> > >
> > > Gabor Szokoli
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > > For additional commands, e-mail: users-help@wicket.apache.org
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: PageParameter backed models?

Posted by Gabor Szokoli <sz...@gmail.com>.
Hi,

We have been happy with the below suggestion for keeping our search
criteria in the URL:

 onsubmit() {
       setresponsepage(searchpage.class, crit.topageparameterrs());
   };

Now we are beginning to experience the downsides: non-parameter backed
models on the page (how many rows to display per page for example) get
lost in this cycle.

Could you guys suggest some in-between approach, where part of the
state is stored in the URL, but the rest is kept in the components
(models)?


Thanks:

Gabor Szokoli


On Nov 28, 2007 9:46 PM, Igor Vaynberg <ig...@gmail.com> wrote:
> why not just
>
>
> class searchpage extends webpage {
>   private PageParameters params;
>
>   private criteria crit=new criteria();
>
>   public searchpage(pageparameters params) {
>     this.params=params;
>
>   add(new dataview("results", new dataprovider()) {... });
>
>   form form=new form("form", new compoundproperty(new
> propertymodel(this, "crit"))) {
>    onsubmit() {
>       setresponsepage(searchpage.class, crit.topageparameterrs());
>   };
>   add(form);
>    form.add(new textfield("name")); ....
>
>
>   }
>
>
>
>   private class dataprovider implements idataprovider {
>     public iterator iterator(...) {
>        return dao.search(params);
>    } public int size() { return dao.size(params); }
>   }
>
>
> done
>
> -igor
>
>
>
> On Nov 28, 2007 12:34 PM, Gabor Szokoli <sz...@gmail.com> wrote:
> > Hi there,
> >
> > I'd like to have a search form, which keeps the last submitted search
> > parameters in PageParameters in a bookmarkable fashion.
> > I am wondering about the "wicket way" of doing this, and I keep coming
> > back to an imaginary LoadableDetachableModel variant which would store
> > a unique key, and load/store its object value from/to the
> > PageParameters.
> > I'd appreciate some advice: What would be the nicest way to get hold
> > of the pageparameters in the current request from a model, and to set
> > one in the next response?
> > Or Is there some better way to achieve bookmarkable (partial) form state?
> >
> >
> > Thanks in advance:
> >
> > Gabor Szokoli
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: PageParameter backed models?

Posted by Gabor Szokoli <sz...@gmail.com>.
Indeed!

Thank you.

On Nov 28, 2007 9:46 PM, Igor Vaynberg <ig...@gmail.com> wrote:
> why not just
>  ...

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: PageParameter backed models?

Posted by Igor Vaynberg <ig...@gmail.com>.
why not just


class searchpage extends webpage {
  private PageParameters params;

  private criteria crit=new criteria();

  public searchpage(pageparameters params) {
    this.params=params;

  add(new dataview("results", new dataprovider()) {... });

  form form=new form("form", new compoundproperty(new
propertymodel(this, "crit"))) {
   onsubmit() {
      setresponsepage(searchpage.class, crit.topageparameterrs());
  };
  add(form);
   form.add(new textfield("name")); ....


  }



  private class dataprovider implements idataprovider {
    public iterator iterator(...) {
       return dao.search(params);
   } public int size() { return dao.size(params); }
  }


done

-igor


On Nov 28, 2007 12:34 PM, Gabor Szokoli <sz...@gmail.com> wrote:
> Hi there,
>
> I'd like to have a search form, which keeps the last submitted search
> parameters in PageParameters in a bookmarkable fashion.
> I am wondering about the "wicket way" of doing this, and I keep coming
> back to an imaginary LoadableDetachableModel variant which would store
> a unique key, and load/store its object value from/to the
> PageParameters.
> I'd appreciate some advice: What would be the nicest way to get hold
> of the pageparameters in the current request from a model, and to set
> one in the next response?
> Or Is there some better way to achieve bookmarkable (partial) form state?
>
>
> Thanks in advance:
>
> Gabor Szokoli
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org