You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Flavius (JIRA)" <ji...@apache.org> on 2007/12/14 16:01:43 UTC

[jira] Updated: (WICKET-1164) Passing Parameters on a Bookmarkable Page Link

     [ https://issues.apache.org/jira/browse/WICKET-1164?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Flavius updated WICKET-1164:
----------------------------



The problem with how the PageParameters work now is that they only handle primitive types and Strings.
If I put a complex POJO in the pageParameters and pass it along to a BookmarkablePageLink, the target
page will throw a ClassCastException, because it's trying to get the String value for the URL.

If I do this:
                        PageParameters parameters = new PageParameters();
			parameters.put("search", search);
			
			BookmarkablePageLink link = new BookmarkablePageLink(name, TargetPage.class, parameters);
		        link.setParameter("id", getId());			
				
the target page will throw the exception.  Now I CAN do this with a page link, simply because I have access to the 
onClick() event.  But for the BookmarkablePageLink, it's final and I can't override it.

                        final PageParameters parameters = new PageParameters();
			parameters.put("search", search);
			parameters.put("id", getId());
			
			PageLink link = new PageLink(name, TargetPage.class)
			{
				public void onClick()
				{
					setResponsePage(new TargetPage(parameters));
				}
			};

What I envision is the BookmarkablePageLink working like the PageLink (exposing the onClick()) so parameters
can be passed with complex objects.  When the BookmarkablePageLink is building the url, it will wrap the
cast in a try/catch.  If it gets a class cast, it omits that parameter from the url.  But it would still pass the object
along the request.  

So in this case, if the user is logged in, the TargetPage would get an id and a search object.  If the user
bookmarked the url and came back later (not logged in), the url would simply be http://localhost/pages/TargetPage/id/56,
for example.



> Passing Parameters on a Bookmarkable Page Link
> ----------------------------------------------
>
>                 Key: WICKET-1164
>                 URL: https://issues.apache.org/jira/browse/WICKET-1164
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket
>         Environment: Any
>            Reporter: Flavius
>
> Change the behavior of a bookmarkable page link so that a URL can be explicitly set
> with a redirect to buffer strategy.  This would allow bookmarkable URLs to be created,
> but also allow parameters to be passed to the target.
> An example of where this would be useful would be viewing a summary and detail
> page.  You want to be able to bookmark the detail page URL.  If the user had conducted
> a search and clicked an item in the summary page to view the detail, a reference to the
> summary results could be passed along.  When the user returns to the summary,
> the previous results can be repopulated.  However, if the detail page is bookmarked,
> information on the search results is not put in the URL, but the link to the detail still is.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.