I have JSF pages which have links to other JSF pages . When I click on the link and if the session has already expired , control goes to login page. And I will login with username password and again come to same page where I have clicked on link. Now I will click on the link, a blank page is getting displayed, and if i do page refresh by F5, the expected page loads.
And also I have checked the console on my Jboss server, the View Expired exception is not appearing.
SO I am bit confused which way I handle this to avoid blank page getting displayed.
Please help.
This can happen if you’re performing link navigation by ajax and the page returned after login was been served from the browser cache (and thus contains a form with an outdated view state identifier). You need to tell the browser to not cache restricted pages. You can achieve this with the following filter:
Note that this problem thus also suggests that you’re using (ajax) command links for page-to-page navigation. This is a bad practice. Those links are not SEO friendly nor bookmarkable. Command links should be used for form submits only. Use normal links for page-to-page navigation. See also When should I use h:outputLink instead of h:commandLink?