...
However, you can accomplish the same thing with a little code and markup. For example, to create a link to another page and pass a query parameter, you can replace your PageLink component with
a standard <a>
tag:
Code Block | ||||
---|---|---|---|---|
| ||||
<a href="${profilePageLink}">Display Profile (w/ full details)</a> |
...
Code Block | ||||
---|---|---|---|---|
| ||||
@Inject private PageRenderLinkSource linkSource; public Link getProfilePageLink() { Link link = linkSource.createPageRenderLinkWithContext(DisplayProfile.class, user); link.addParameteraddParameterValue("detail", "true"); return link; } |
... and in the DisplayProfile page:
...
The @RequestParameter annotation directs Tapestry to extract the query parameter from the request and coerce it to type boolean. You can use any reasonable type for such a parameter (int, long and Date are common).
A similar technique can be used to add query parmeters to component event URLs (the type generated by the ActionLink or EventLink URLscomponents), by injecting the ComponentResources, and invoking method createEventLink()
.