|
Page Edited :
WICKET :
Bookmarkable pages and links
Bookmarkable pages and links has been edited by Antony Stubbs (Sep 04, 2007). Change summary: clarified grammar Bookmarkable vs non-bookmarkable pagesPages can be constructed with any constructor when they are being used in a Wicket session, but if you wish to link to a Page using a URL that is "bookmarkable" (which implies that the URL will not have any session information encoded in it, and that you can call this page directly without having a session first directly from your browser), you need to implement your Page with a no-arg constructor or with a constructor that accepts a PageParameters argument (which wraps any query string parameters for a request). In case the page has both constructors, the constructor with PageParameters will be used. If you have a Page with a default constructor and not a PageParameter constructor then it will default to one without any warning or error. Because wicket doesn't check if there are really request parameters for it and wicket can't know if they are really meant for this page or not. Non-bookmarkable pages have default constructors and constructors with the PageParameters argument hidden (protected/private), or none at all. It could have any other constructor, like MyPage(FooClass bar) etc. The net effect of your page being non-bookmarkable is that there is no way a user can directly access your page. So, by making a page non-bookmarkable, you make it a 'safe' page. A recommended approach is that bookmarkable pages do nothing in their default behaviour (construction time) that can harm you (like deleting records etc), and that everything you want to hide, should be either put in protected pages, or in handlers such as links and forms on the pages. Note that those handlers are protected too, as they can never be called directly without having created the page instance first. Linking to pages can be done in multiple ways: First one is by just using the Link class directly: new Link() { public void onClick() { setResponsePage(new MyPage(...)); } }
|
Unsubscribe or edit your notifications preferences
