This Confluence has been LDAP enabled, if you are an ASF Committer, please use your LDAP Credentials to login. Any problems file an INFRA jira ticket please.

Child pages
  • Link
Skip to end of metadata
Go to start of metadata

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.

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.

(The example also shows how the 'Edit' page can return to the instance of the 'List' page once editing is complete.)

class ListUsersPage extends Webpage {
    .....
    add(new Link("edit") {
        onclick() {
           setResponsePage(new EditUserPage( ListUsersPage.this, (User)getModelObject()));
        }
}

class EditUserPage extends WebPage {
    public EditUserPage(final WebPage backPage, User user) {
            Form form;
            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
                 });}}

[From a posting of Igor's to the wicket-user list - Gwyn 08:59, 21 Jul 2006 (BST)]

  • No labels