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

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -