I want to invoke method of ViewScoped bean when some h:link is clicked (or opened in new tab or window) before faces servlet begins to handle GET request.
I have a lot of ViewScoped beans for different pages and when I go from one to another I need the first one to put its state into some pocket and the second page to get state from pocket and save it as parent's state.
For h:commandLink there is an action that saves state on click. But h:commandLink cannot be opened in new tab (or can be?). So I want to use h:link in the same way but can't find a place to call method of saving state.
I've tried some manipulations with javascript and creating custom NavigationHandler but they have some drawbacks.
Is there any clear way for doing what I want?