I have a form and there are several fields in it and some of these are required. I have two buttons on this page1. 1) button1 is to proceed to page2. 2) button2 navigates to page3.
If I enter values in all the required fields and click button1, it works fine and takes me to the page2. but, if I don't enter anything in the required field, and click on the button 1, then the required validation fails, so it comes back to the same page. After that even if I enter values in all the fields and click on the button 1, it takes me to the page3(which is the destination of button2).
Also, I have a link on page3 to go to the page2, but even that link stops working and takes me to some other page, which I have not specified for this link's action .
please help, I am not able to understand what is happening here.
I am getting the same problem as you have been experincing that navigation keeps returning to the same page.
Below are some code samples for reference. Also, I put some logs to capture the behavior.
The navigation works and sometimes doesn't work depending on the certain situation as you have describe above.
This is my observation of navigation not working from looking in the logs. Everytime I hit the link and it returns to the same page. I don't see the method "viewEditAction" being called by JSF. Instead it reconstruct the same page again, so I will see the constructor of "SearchRequestFaces" being called again.
I assume one thing that there could be exception or error in JSF that it keeps the previous request in the Faces Context for that particular session. It might not work on my session but it might work on other session.
FOR QUICK FIX, I usually close all my IE to force to get a new session and to restart the app server.
I hope this help. I am still looking for the answer for this navigation not working. I need look in the FacesContext to see what is happening there. I will let you know if I find something informative.
well, for me I know for sure that the navigation doesn't work only after validation fails and only for a button and a link... and this behaviour doesn't change even after restarting the server or closing all the explorer. I am sure there is some JSF life cycle matter here which I don't know.
experts, please suggest something.
Joined: Jun 02, 2005
I tried a phaseListener and just printed the facesContext.getViewRoot().getViewId() before and after all the phases and it turns out that after the validation fails and when I click any other links or button the viewId changes in the APPLY_REQUEST_VALUES phase... why is that and how does it gets the view id that is not specified for that button or link is not clear to me...