How to build “edit” button in JSF and switch between h:outputText and h:inputText
问题 How can I create an "edit" button so that when the button is clicked it will change the h:outputText to h:inputText ? 回答1: Make use of the rendered attribute: <h:outputText value="#{bean.entity.property}" rendered="#{not bean.editmode}" /> <h:inputText value="#{bean.entity.property}" rendered="#{bean.editmode}" /> ... <h:commandButton value="Edit" action="#{bean.edit}" rendered="#{not bean.editmode}" /> <h:commandButton value="Save" action="#{bean.save}" rendered="#{bean.editmode}" /> With