You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Multiple Markups Per Page

With wicket, every html markup page is controlled by a Class file, a panel, etc. It does make sense at times to have a single class file manage multiple markup files, or "variations" in Wicket land. You can do so using the following code in the Page:

{panel}
    public MyPage(PageParameters parameters) {
{panel}

{panel}
        if(parameters!=null) {
            this.variant = (String)parameters.get("variant");
        }
    }
{panel}

{panel}
    private String variant;
{panel}

{panel}
    public String getVariation() {
        return variant;
    }
{panel}

Where variant is passed in as a request parameter, so a request to /MyPage?variant=abc would retrieve MyPage_abc.html and /MyPage?variant=xyz would retrieve MyPage_xyz.html.

  • No labels