You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Eyal Golan <eg...@gmail.com> on 2009/12/09 12:57:27 UTC

PageParameters and BookmarkablePageLink

Hi,
I have a BookmarkablePageLink that I set parameters for it:
...
String configurationName = "conf";
ConfigurastionUser firstEntity = getFirstEntity();
PageParameters parameters = new PageParameters();
parameters.add("configurationName", configurationName);
parameters.add("firstEntity", firstEntity);
Link link = new BookmarkablePageLink("link", LinkAttributesPage.class,
parameters);
...

And in LinkAttributesPage, I have:
public LinkAttributesPage(PageParameters parameters) {
  String confName = parameters.getString("configurationName");
  ConfigurationUser user = parameters.get("firstEntity");
  ...
}

ConfigurationUser class is Serializable.
I get a ClassCastException for the firstEntity.
We use Wicket 1.3.6
Is this OK?

My solution is to have a constructor for that page that accepts the correct
parameters, but I want to know if it's a bug in the PagePArameters or if I
am misusing it.

Thanks

Eyal Golan
egolan74@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

Re: PageParameters and BookmarkablePageLink

Posted by Eyal Golan <eg...@gmail.com>.
OK. I understand.

Yes, I prefer passing it as an object.
So I switched the page LinkAttributesPage to have a constructor that accepts
the OBJECTS I need.
If I ever need it with URL, then I'll add the PageParameters and will get
the objects by keys.

Thanks,


Eyal Golan
egolan74@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 Wed, Dec 9, 2009 at 2:23 PM, Bert <ta...@gmail.com> wrote:

> Hi,
>
> the parameter value (a ConfigurastionUser in your case) is converted
> to a String using
> toString(). Are you sure that you want to pass in that object and not
> an ID of it?
>
> Bert
>
> On Wed, Dec 9, 2009 at 12:57, Eyal Golan <eg...@gmail.com> wrote:
> > Hi,
> > I have a BookmarkablePageLink that I set parameters for it:
> > ...
> > String configurationName = "conf";
> > ConfigurastionUser firstEntity = getFirstEntity();
> > PageParameters parameters = new PageParameters();
> > parameters.add("configurationName", configurationName);
> > parameters.add("firstEntity", firstEntity);
> > Link link = new BookmarkablePageLink("link", LinkAttributesPage.class,
> > parameters);
> > ...
> >
> > And in LinkAttributesPage, I have:
> > public LinkAttributesPage(PageParameters parameters) {
> >  String confName = parameters.getString("configurationName");
> >  ConfigurationUser user = parameters.get("firstEntity");
> >  ...
> > }
> >
> > ConfigurationUser class is Serializable.
> > I get a ClassCastException for the firstEntity.
> > We use Wicket 1.3.6
> > Is this OK?
> >
> > My solution is to have a constructor for that page that accepts the
> correct
> > parameters, but I want to know if it's a bug in the PagePArameters or if
> I
> > am misusing it.
> >
> > Thanks
> >
> > Eyal Golan
> > egolan74@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
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: PageParameters and BookmarkablePageLink

Posted by Bert <ta...@gmail.com>.
Hi,

the parameter value (a ConfigurastionUser in your case) is converted
to a String using
toString(). Are you sure that you want to pass in that object and not
an ID of it?

Bert

On Wed, Dec 9, 2009 at 12:57, Eyal Golan <eg...@gmail.com> wrote:
> Hi,
> I have a BookmarkablePageLink that I set parameters for it:
> ...
> String configurationName = "conf";
> ConfigurastionUser firstEntity = getFirstEntity();
> PageParameters parameters = new PageParameters();
> parameters.add("configurationName", configurationName);
> parameters.add("firstEntity", firstEntity);
> Link link = new BookmarkablePageLink("link", LinkAttributesPage.class,
> parameters);
> ...
>
> And in LinkAttributesPage, I have:
> public LinkAttributesPage(PageParameters parameters) {
>  String confName = parameters.getString("configurationName");
>  ConfigurationUser user = parameters.get("firstEntity");
>  ...
> }
>
> ConfigurationUser class is Serializable.
> I get a ClassCastException for the firstEntity.
> We use Wicket 1.3.6
> Is this OK?
>
> My solution is to have a constructor for that page that accepts the correct
> parameters, but I want to know if it's a bug in the PagePArameters or if I
> am misusing it.
>
> Thanks
>
> Eyal Golan
> egolan74@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
>

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