Redirect page JSF

1

I have a SessionScoped bean that I use to navigate data from page 1 to page 2. Page 1 is accessed from the menu, page 2 is accessed by a button inside page 1 where some filter-based data is loaded this first page. My question is this: Should the user type the url of this page 2 in hand, how can I redirect it to the first page?

    
asked by anonymous 09.10.2015 / 19:10

1 answer

0

Call a method of your Bean before initializing page 2, make sure the user has filled in the required data on page 1, if not redirected to page 1.

Using the tags below, page 2 is not reloaded:

<f:metadata>
    <f:viewAction action="#{pagina2Bean.inicializar()}"/>
</f:metadata>

Note: tag (f) is from the JSF Core library.

Or do with JavaScript:

window.onload = new function(){
  #{pagina2Bean.inicilizar()}
}
    
22.07.2017 / 20:13