Hi I have an Java EE 7 Application in NetBeans 8.0.2 running on Glassfish 4.01
I use @ManagedBean @SessionScoped
as a controller UserController.java
I have an index.xhtml
Facelet and an signup.xhtml
Facelet
In the index.xhtml
Facelet I have
<h:commandButton value="Sign Up" action="#{userController.signUp()}"></h:commandButton>
which calls the function public String signUp() {
in the UserController.java
In this function I return return Pages.SIGN_UP_PAGE;
which renders the Face let signup.xhtml
there I have a Form to fill in your user data such as user Name email and password.
The first thing is that when I return Pages.SIGN_UP_PAGE;
the page signup.xhtml
gets rendered but in the URL still stands .../faces/index.xhtml
In signup.xhtml
I have the
<h:commandButton value="Create User" action="#{userController.createNewUser()}"></h:commandButton>
Then in the public String createNewUser()
function I return return Pages.USER_ACTION_OVERVIEW;
which renders the page overview.xhtml
but then with the URL
.../faces/signup.xhtml
which leads to the bigger problem that when I refresh now the page ( the overview page which shows me the data of the new signedUp user ) I send a POST request again to signUp() the same user with the same POST Parameters.
What I need is that if i render the page, that the right URL is displayed ( the on of the page which is rendered ) and that if I refresh that page that not again the old POST request gets send.