jsf - How to keep changing commandbutton name after every clicks -
my question example,i have button named "a", after click change button name "b", , if click again change "a" , keep changing between "a" , "b" when clicked. how can achieve this?
toggle boolean in action method , check in button's value boolean state.
private boolean toggle; public void toggle() { toggle = !toggle; } public boolean istoggle() { return toggle; }
<h:commandbutton value="#{bean.toggle ? 'b' : 'a'}" action="#{bean.toggle}"> <f:ajax render="@this" /> </h:commandbutton>
Comments
Post a Comment