<ui:define name="titulo da pagina">Cadastro De Bairro</ui:define>
<ui:define name="miolo">
<div class="conteudo_do_modulo">
<h:form id="Salvar" acceptcharset="ISO-8859-1" lang="pt_BR">
<fieldset>
<ui:fragment rendered="#{!BairroBean.editar}">
<h:outputLabel value="Cadastrar novo Bairro" />
<h:inputText value="#{BairroBean.nomeNovo}" id="novoBairro" />
<h:commandButton value="Salvar"
action="#{BairroBean.salvarBairro()}" />
<br />
<br />
</ui:fragment>
<ui:fragment rendered="#{BairroBean.editar}">
<h:outputLabel value="Valor Atual" for="nomeAntigo" />
<h:inputText value="#{BairroBean.nomeAntigo}" readonly="true" id="nomeAntigo" />
<h:inputHidden value="#{BairroBean.nomeAntigo}" id="valorAntigo" />
<br /> <br />
<h:outputLabel value="Digite O Novo Bairro" for="novoBairro2" />
<h:inputText value="#{BairroBean.nomeNovo}" id="novoBairro2" />
<h:commandButton value="Alterar" action="#{BairroBean.editarBairro()}" />
</ui:fragment>
</fieldset>
</h:form>
</div>
</ui:define>
I am having a question because only a commandbuttom works I solved the problem but wanted to know why. even though I say when they should render only the 'Save' button works, I had to separate in two form to solve.
1) - I tried to remove the ui: fragment it worked, before it was a wm: fragment for each button with the condition to render.
2) I tried to leave a block with outputformat and to do the logic tb did not give. just leave a block with ui: fragment and the other one to appear when you want
3) I tried to do the logging in the 'save' and 'change' buttons.
methods check, so much so that it was only split into 2 forms and worked. the beans are request scope.
Thanks to everyone ^^