I want to use a link or a button like (a href="..."/>) in GWT with uiBinder.
I found the widget "hyperlink" but I don´t know how I use that.
You should use the Anchor widget.
You can use a sample ClickHandler on it to detect the click event or use the default href with the constructor :
Anchor(boolean useDefaultHref)
You can also use the setter setHref(java.lang.String href)
In UiBinder :
<g:Anchor ui:field="mylink" href="/myurl">The link test</g:Anchor>
EDIT :
To open the link in a new tab, you should use the setTarget(String target) method like the following example :
setTarget("_blank");
Unless you need to programatically do things with the anchor, you can just add the html into the uibinder code directly. In fact, UIBinder is not just a WYSIWYG, but it is a place for you to enter as much native HTML as you can. That makes for leaner and faster web apps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With