@UiField Hyperlink historyLink;
this.historyLink.getElement().setAttribute("rel", "nofollow");
这将设置包含 div 的 rel 属性。
<div class="gwt-Hyperlink" rel="nofollow"><a href="#!h:home">history</a></div>
我如何获得a标签?
@UiField Hyperlink historyLink;
this.historyLink.getElement().setAttribute("rel", "nofollow");
这将设置包含 div 的 rel 属性。
<div class="gwt-Hyperlink" rel="nofollow"><a href="#!h:home">history</a></div>
我如何获得a标签?
您可以通过a这种方式获取元素
Element a = historyLink.getElement().getFirstChildElement();
也许您可以使用 anInlineHyperlink代替(如果您根本不想要div包装器),但实际上我不明白在rel=nofollow带有#hash -only href 的链接上的使用:如果那是用于 Google AJAX 爬行,不能您只是避免在响应_escaped_fragment_请求而发送的 HTML 快照中输出链接?