I'm starting with JSF2 and primefaces and I have a question about the life cycle. I explain it briefly: I have pagina1.xhtml that contains a table with a list and editing buttons, including a button again (action="page2") that points to another page that we will call pagina2.xhtml where there will be some fields to add a new record. Then we have a bean for page1 that we will call BeanPagina1 where there is an init method with the @PostConstruct annotation.
Well, let's see, if from the main menu we access page1, the flow passes through the init method of the bean where the data in the table is loaded and that page will be displayed. Now, if I press the new button on page1 I see that the flow also passes through the init method of the Bean even though the method refers to another page. This is what I do not understand, is it normal for this to happen? I have also tried to create a proper bean for page2 that we will call BeanPagina2 and in it a method (start) that returns a String with the name page2. Then in the action of the button on page1 put "# {beanPagina2.inicio ()}". In this way the same thing happens, first it passes through the init method (@PostConstruct) of BeanPagina1 and then it goes to BeanPagina2. I do not know if this is the correct life cycle. Of course, in my case in that @PostConstruct method of the BeanPagina1 I make the call to the database for the recovery of the data of the table but I do not see correct that every time I press a button I will recover the data of the table again ...