0

Hi I have a JSF "Register.xhtml" inside I have two Primefaces Command Buttons:

<p:commandButton id="registerButton" 
    action="#{registerController.register()}" rendered="#{!registerController.IsUserRegistered()}" />
<p:commandButton id="unregisterButton" 
    action="#{registerController.unregister()}" rendered="#{registerController.IsUserRegistered()}"/>

It works if I manually refresh the page.

enter image description here

I want a method to show the unregisterButtonand hiding the registerButton after I call the registerController.register() function by clicking on the register Button.

Kukeltje
  • 12,223
  • 4
  • 24
  • 47
Viktor Carlson
  • 989
  • 1
  • 13
  • 36
  • Possible duplicate of [Why do I need to nest a component with rendered="#{some}" in another component when I want to ajax-update it?](http://stackoverflow.com/questions/9010734/why-do-i-need-to-nest-a-component-with-rendered-some-in-another-component-w) – Kukeltje Mar 17 '16 at 12:08
  • Please take a look at http://jsf.zeef.com and read all stackoverflow posts mentioned there. Also read some basic tutorials. And try searching for the more general issue... Is/was it really related to `p:commandButton` or would `h:commandButton` with `f:ajax` fail to? Or other components... then you most often find a more generic problem en very often a matching existing Q/A – Kukeltje Mar 17 '16 at 12:10

1 Answers1

-1

You need to refresh the part of the page where the second button is after the click on the first button. With Primefaces you can use PartialSubmit, http://www.primefaces.org/showcase/ui/ajax/partialSubmit.xhtml

  • Why is partial submit relevant here? And the _'part of the page'_ is to vague is that the other commandButton or what is mentioned in the 'duplicate' (which contains al the info) – Kukeltje Mar 17 '16 at 14:55