2012-04-18 22 views
0
@UiField Hyperlink historyLink; 
this.historyLink.getElement().setAttribute("rel", "nofollow"); 

這設置了包含div的rel屬性。如何設置HyperLink小部件的rel屬性?

<div class="gwt-Hyperlink" rel="nofollow"><a href="#!h:home">history</a></div> 

我該如何獲得a標籤?

回答

1

也許你可以使用一個InlineHyperlink代替(如果你不想div包裝的話),但實際上我不明白使用rel=nofollow的鏈接#hash-only href:如果這是針對Google AJAX抓取,難道你不能簡單地輸出你發送的HTML快照中的鏈接以響應_escaped_fragment_請求嗎?

+0

InlineHyperlink似乎比使用超鏈接更好。 – 2012-04-19 15:48:58

2

你可以得到a元素這樣

Element a = historyLink.getElement().getFirstChildElement();