jsf 2 - If i lost the JSF Session scope i want to change to the login page -


I used JSF 2.2 Moserra and Session Scope.

After some time the session scope is removed or something else. If I go back to the login page and log in again, I have a new session area and everything works again.

If I have worked on a web application then the area of ​​session has not been lost, and I have no problem. So I think it should be lost after some time if I do not use the web application.

Any ideas I have lost the chance of the session, so how can I return to the login page automatically?

Your state savings method should be set below like a server to expect < / P>

  & lt; Context param & gt; & Lt; Ultimate Name & gt; javax.faces.STATE_SAVING_METHOD & lt; / Lastname & gt; & Lt; Ultimate Price & gt; Server & lt; / Super-valued & gt; & Lt; / Reference param & gt;   

After that, you can access your web.xml

  & lt; Session-config & gt; & Lt; Session timeout & gt; 20 & lt; / Session timeout & gt; & Lt; / Session-config & gt;   

If you are useless for more than 20 minutes and if you try to make any requests from the page, you will see an exception stack trace of Exide exceptions. To redirect it to the login page, you have the web .xml

  & lt; Error-page & gt; & Lt; Exception Type & gt; Javax.faces.application.ViewExpiredException & lt; / Exception type & gt; & Lt; Location & gt; Your login page path & lt; / Location & gt; & Lt; Error page & gt;   

If you request non-ajax requests from the page after the session time, then it will work. Now it requires a special exception handler for exceptions to the AJAX requests to work on clicking an AJAX button. You can access & lt; from the Preferences extension library. Pe: ajaxErrorHandler & gt; .

To use it, you must have your face-config.xml

  & lt; Application & gt; & Lt; Al Solariser & gt; Org.primefaces.application.exceptionhandler.PrimeExceptionHandlerELResolver & lt; / L solverge & gt; & Lt; / Application & gt; & Lt; Factory & gt; & Lt; Exception-handler-factory & gt; Org.primefaces.application.exceptionhandler.PrimeExceptionHandlerFactory & lt; / Exception-handler-factory & gt; & Lt; / Factory & gt;   

and master location extension namespace xmlns: pe = "http://primefaces.org/ui/extensions" .

Now on your page, & lt; Pe: ajaxErrorHandler / & gt; After the session time it will navigate to the page to click on the Ajax button on the page.

For automatic navigation to page login on time, you can & lt; p: idleMonitor & gt; something like

  & lt; P: can use disable monitor timeout = "6000" onidle = "idleDialog.show ()" />   

Please take a look at this question for the correct implementation of Passive Monitor

If you are using IceFace please go to the following link >

You can also use the Fullizax Exception Handler, Google for this.

Hope it helps !!!

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -