簡體   English   中英

JSF 2.0 - 改變組件風格

[英]JSF 2.0 - change component style

我有簡單的組件 - CommandButton

   <tr:commandButton text="test" styleClass="form-button"
    actionBean="#{testPage}" action="synchAction" 
    partialSubmit="true" id="btnId" />

這個commandButton使用styleClass表單按鈕。

我在支持bean中有一些布爾成員,它在一些事件觸發器后改變它的值。

是否可以根據該布爾值更改我的commandButton StyleClass

我的意思是,當這個布爾值變為true時,commandButton styleClass將改為some-other-style。

我感謝任何幫助,

謝謝,

約翰

styleClass屬性中使用el表達式和三元運算符:

 <tr:commandButton text="test" 
             styleClass="#{bean.boolVal ? 'form-button' : 'another-style'}"
             actionBean="#{testPage}" action="synchAction" 
             partialSubmit="true" id="btnId" />

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM