1
In my registration screen I have 2 buttons: Save and Come back.
In case I am editing some record, the button is enabled New.
My problem is when I click this button New the screen gives the refresh but what I want is to clean the data for a new registration. A help please?
Method that is triggered when I click the button:
public void novo(){
if (nature == null){
nature = new Nature();
} else{
nature = null;
}
}
Button code:
<p:commandButton actionListener="#{habilidademb.novo}" value="Novo" ajax="false" update="cadastro" rendered="#{naturemb.nature.id != null}" styleClass="separadorBotoes"/>
The problem is that you can not mark ajax="false", you are exactly making the screen give refresh. take this option, by default jsf already leaves ajax as true.
– Geferson
Another thing, in your new() method, you don’t need to do any checking, just let Nature = new Nature();
– Geferson