...
Scope
...
This page describes the use of the Link component. It is not meant to replace the available Javadoc. Common usage questions (FAQ) of the component will be addressed here, along with background/design information, and examples where applicable.
Background
FAQ
Examples
=Background=
=FAQ=
...
To pass your own objects from one page to another as part of link, just use {{setResponsePage}}as below, i.e. passing in a instance of the new page created with your custom constructor.
...
Code Block |
---|
class ListUsersPage extends Webpage { {panel} ..... add(new Link("edit") { onclick() { setResponsePage(new EditUserPage( ListUsersPage.this, (User)getModelObject())); } {panel} } class EditUserPage extends WebPage { {panel} public EditUserPage(final WebPage backPage, User user) { Form form; {panel} {panel} add(form=new Form("form", )); form.add(new Button("save") { onsubmit() { //save user setResponsePage(backPage); <=== navigates to the list users page in its previous state });}} {panel} |
[From a posting of Igor's to the wicket-user list - Gwyn 08:59, 21 Jul 2006 (BST)]category:FAQ category:Component