如何创建GWT的可点击链接? [英] How to create clickable link with GWT?

查看:101
本文介绍了如何创建GWT的可点击链接?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用GWT制作一些可点击的链接。我不确定这是否是最佳做法。基本上我想要类似这样的东西,如果我用html写的

< a href =index.htmlalt = >链接< / a>

解决方案

使用超链接如果您想链接链接到某个地方(意味着它触发了历史更改事件)。

使用锚点,如果您想链接到应用程序的网站外部。


 超链接链接=新超链接(链接到foo,foo); //文本将是链接到foo,会将您的网址更改为yourSite.html#foo 
锚点锚点=新锚点(链接到酒吧,www.bar.com); //文本将是链接到栏,会将您重定向到www.bar.com


I want to make some clickable links with GWT. I'm not sure if this is the best practice for it. Basically I want something that similar like this if I would've written with html

<a href="index.html" alt="">Link</a>

解决方案

Use a Hyperlink if you want to "link to some place" in your app (meaning it fires a History change event).
Use an Anchor if you want to link to a site ouside of your app.

Hyperlink link = new Hyperlink("link to foo", "foo"); //text would be "link to foo", would change your url to yourSite.html#foo
Anchor anchor = new Anchor("Link to bar", "www.bar.com"); //text would be "link to bar", would redirect you to "www.bar.com"

这篇关于如何创建GWT的可点击链接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆