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 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
Re: PageParameters and BookmarkablePageLink
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 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 > 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 > - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: PageParameters and BookmarkablePageLink
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 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 Wed, Dec 9, 2009 at 2:23 PM, Bert 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 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 > > 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 > > > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > >