Reputation: 3538
I can create a link to a page using this .tml code. This generates a link to eg "/path/case314":
<t:pagelink page="${pageName}" t:context="case">
linked text
</t:pagelink>
I want to create a path to eg "/path/case314#comment-id-90".
If I try to direct my link to an anchor within a page, like so (where there is a div of id #comment-id-${currentComment.id} in the targeted page):
<t:pagelink page="${pageName}#comment-id-${currentComment.id}" t:context="case">
linked text
</t:pagelink>
Then I lose my context, and I get the default pageName path, like so: "/path/caseexample#comment-id-90". Which doesn't exist, so Tapestry throws an exception.
The same thing happens if I try to create a class manually constructing the link- passing pageName as a parameter results in "caseexample" rather than the correct "case314".
Can anyone tell me how I can build an anchor link while maintaining the necessary context for the pagelink to work?
Thank you!
Upvotes: 0
Views: 1154
Reputation: 8165
Just for information, see there for the list of parameters available for the pagelink component.
You'll see the "anchor" param used by uklance.
Upvotes: 1
Reputation: 27994
<t:pagelink page="prop:pageName" anchor="comment-id-${currentComment.id}" context="case">linked text</t:pagelink>
Upvotes: 1