Hi Chris,

you're right, the returned String is used directly as the page name and
doesn't support any additions.


IMO, there are two options how to implement such a feature:



   - Allow an anchor at the end of the String, and set it
   PageNameComponentEventResultProcessor
   - Use an intermediate type holding all the options available for a Link
   with a fluent API instead, e.g.
   LinkParams.page("index").anchor("footer").addQueryParameter("foo",
   "bar").activationContext(myContext1, myContext2)


The first option would be the easiest to implement because it only affects
a single class (if I'm correct).

But this approach leaves out the other features a customized Link could
provide.


The second option would require a new ComponentEventResultProcessor and the
holder type.


What do the others think?

Should this be pursued as an easier option for navigation?


If you need/want the feature now you could override the
PageNameComponentEventResultProcessor, it's contributed here:


https://github.com/apache/tapestry-5/blob/1578f4427fdf7e2113de8d5b4159ff40bbd2c5b6/tapestry-core/src/main/java/org/apache/tapestry5/modules/TapestryModule.java#L1618


Cheers,

Ben



On Mon, Mar 21, 2022 at 5:35 AM Christopher Dodunski (Tapestry) <
chrisfromtapes...@christopher.net.nz> wrote:

> Hi,
>
> Quick question: Tapestry is flexible when it comes to return types for
> page navigation.  "When a string is returned, it is expected to be the
> logical name of a page."  Although I've not tried it, presumably this
> means the likes of "Index#footer" isn't possible for navigating to a
> particular place in a page.  Is creating a 'Link' object along with
> setAnchor() the usual/only approach for achieving this from within a
> page's class?
>
> Thanks & regards,
>
> Chris.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>

Reply via email to