Nils
Nils

Reputation: 785

Render a requestParameter in Tapestry

I like to render a reqeustParameter "id" in my Tapestry Page.

Something like:

<span>${id}</span>

If I request the page with google.com?id=1 it should render <span>1</span> Should be possible, but cant find a solution.

The doc suggest to use @Property in the Java-Class, but I can't import that. --> http://tapestry.formos.com/nightly/tapestry5/guide/parameters.html

thx

Upvotes: 1

Views: 1670

Answers (1)

Henning
Henning

Reputation: 16311

Evaluating query parameters is a little bit uncommon in Tapestry, but if you absolutely need them (e.g. some external process calls your page with a parameter), you can access them through the Request service:

@Inject
private Request request;

public String getId() {
    return this.request.getParameter("id");
}

Upvotes: 5

Related Questions