I think it is quite easy? If we implement that feature request it
would be easier as it would be build in. But so many hours in a day...
I actually forgot part of the code:

new Link("mylink") {
  protected CharSequence getURL() {
    String anchor = getMarkupAttributes().getString("href");
    CharSequence url = urlFor(ILinkListener.INTERFACE);
    if (anchor != null) {
       url = url.toString() + "#" + anchor;
    }
    return url;
  }
  ...
}

or make it a non-annon class. Of course, you don't have to get the
anchor from the markup, as you can just get it from java too.

final String anchor = "foo";
new Link("mylink") {
  protected CharSequence getURL() {
    return urlFor(ILinkListener.INTERFACE) + "#" + foo;
  }
  ...
}

Eelco



On 6/9/06, Scott Sauyet <[EMAIL PROTECTED]> wrote:
> Eelco Hillenius wrote:
> > Basically, you can make a custom link that reads the href attribute
> > (href="#anAnchor"), and that appends that attribute to the URL.
> > Something like this:
>
> Thank you.  I will take a look at it as soon as I can.  Your code
> doesn't work out of the box for me, as I'm right now on some patched
> version of HEAD from December, and I don't seem to have
> getMarkupAttributes() available.  But I will either try to upgrade to a
> later version of Wicket or retrofit your stuff with what I have.
>
> I really expected this would be easier.  At least I don't have to feel
> blind about not finding it.
>
> Thanks again,
>
>    -- Scott
>
>
>
> _______________________________________________
> Wicket-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/wicket-user
>


_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to