2017-02-24 92 views
0

我正在應用程序上工作,設計師讓我瘋狂。它是一個帶有primefaces v.6和apache tomcat v.7的jsf應用程序。哪種方法更適合此目的commandLink或outputLink或鏈接

我有以下的HTML代碼從設計師

<a href="#"><i class="fa fa-sign-out"></i>Logout</a> 

當它的用戶點擊,他從應用程序註銷。

當我使用commandLink

<h:form> 
    <p:commandLink action="#{loginBean.logout}" value="Logout"/>        
</h:form> 

它呈現與一個HTML錨隱藏的輸入字段的形式。因此鏈接看起來不像我的設計師(CSS)。

而當我使用outputLink,以便我可以只有一個錨點時,無法調用bean方法。

而且它也不可能像設計的那樣將此標籤<i class="fa fa-sign-out"></i>置於錨元素內部。

我希望,我是一個明確的,我該如何解決這個問題?爲了有一個JSF的鏈接compenent或任何其他TECHNIC(JSF,primefaces),可呈現類似<a href="#"><i class="fa fa-sign-out"></i>Logout</a>

我喜歡commandLink因爲能力的調用Bean方法

任何幫助將受到歡迎

謝謝!

回答

0

我從來沒有使用過primefaces框架,但是如果我理解正確,p:commandLink標記有styleClass屬性,您可以使用fa fa-sign-out類填充該屬性。

http://www.primefaces.org/docs/vdl/6.0/core/primefaces-p/commandLink.html

如果不工作,你也可以把一個h:outputText標籤p:commandLink內使用的outputText styleClass屬性達到相同的效果。

+0

我使用'styleClass'屬性的'commandLink',但我看起來不像設計師的鏈接。我會嘗試outputText。由於 –

+0

不'outputText'和'styleClass'attribute –

+0

工作我做這種方式' \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t#{味精[ 'dashboard.toprow.logout']} \t \t \t \t \t \t \t' –

相關問題