Problem with the url in JSF and richfaces [closed]

0

I'm doing a project with JSF and richfaces and I have the following problem:

When I advance the page with the "action", the page changes (everything ok), but the url does not. But if you give it back to the same button (because for example it is in a static navigation menu), the second time it changes. And so always ... I do not know how to solve it, I have looked at prettyfaces but the only thing it does is change the url, but it still does not update until I give it twice to the same button (... for example) ...

(I use basic dynamic navigation with faces-config.xml)

I await an answer. Greetings.

    
asked by elemerito 01.05.2017 в 21:18
source

1 answer

0

It is a "peculiarity" derived from how JSF works.

By clicking / submit / etc, JSF goes to the same page where it is to rebuild the component tree, put the values that come from the page, run the driver, etc ...

After all that, it processes the target view but without changing the URL.

So, basic, it's not a problem, your server works correctly 1 .

But there are some situations in which, anyway, it is convenient to have the correct URL in the browser (for example, so that the user can save it in favorites). In those cases (or if you are very upset that the URL does not match) the solution is to add a faces-redirect=true parameter to the URLs.

So for example, if you have the URL /inicio.xhtml , you should put /inicio.xhtml?faces-redirect=true . This means that, instead of building all the HTML corresponding to /inicio.xhtml from the call that invoked the controller, the browser receives an Http Status to do a redirect by GET to /inicio.xhtml , which changes the URL.

1 Or not, but not because of this.     
answered by 01.05.2017 / 22:01
source