[英]Link between XHTML pages?
我使用<h:outputLink value="home.jsf"><h:outputText value="Home"/></h:outputLink>
在XHTML頁面或所謂的Facelets之間移動。
就我個人而言,盡管我更願意使用<h:commandButton>...</h:commandButton>
做同樣的事情。 原因是,將背景圖像放置到按鈕中比使用outputLink和outputText創建CSS解決方法要容易得多 。
有什么辦法嗎?
<h:commandButton>
語法:
<h:commandButton action="#{yourBean.action}" image="yourPic.png" value="your text on the button" styleClass="yourCSS" />
然后,您可以在bean中創建一個操作以重定向到另一個視圖:
FacesContext.getCurrentInstance().getExternalContext().redirect("your destination");
您可以通過以下方式獲取應用程序URL:
FacesContext.getCurrentInstance().getExternalContext().getRequestContextPath();
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.