Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Excerpt
hiddentrue

How to have one Page reference multiple markup pages

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:

Code Block

{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.