问题
I have a problem working with @org.omnifaces.cdi.ViewScoped and multiple tabs:
I have a link in TestPage.xhtml that opens another page (ShowValuePage.xhtml) with a request parameter "someValue". If I open this link 10 times in a new tab and navigate away in the first opened tab, PostConstruct will be called again instead of just navigating away.
Same happens if I navigate back from ShowValuePage to TestPage multiple times. (To test this, we must click the links "Show Value" and "Home" multiple times).
This only happens if more tabs are opened than defined in the web.xml values "numberOfLogicalViews" and "numberOfViewsInSession".
I've set up a small project that shows this problem. The exact description of the procedure can be found in the readme.txt.
Project on github
Is there a workaround for this?
Thank you and best regards
Heinrich
PS: I reported it as a bug on Omnifaces, but since a week I didn't get an answer.
回答1:
It's fixed in OmniFaces 2.7.1 and 3.3.
The symptoms were caused by an explicit redirect which was initially in place in order to trigger any authentication framework which remembers the "last restricted request" to remember the correct request in case the session is expired. This has been fixed by sending the redirect only and only if the session is actually new.
来源:https://stackoverflow.com/questions/52479878/org-omnifaces-cdi-viewscoped-invokes-postconstruct-on-unload-of-an-already-des