pmartin8
pmartin8

Reputation: 1584

Avoid ViewExpiredException in JSF 1.2 on a single page

I have a login page that is not protected and is accessible via different navigation-cases.

The problem: many users access that login page and leave it open for a while before then sign in again. Boom! The terrible ViewExpiredException occurs! I would like to avoid the ViewExpiredException let them sign in again anyway. I don't want a workaround for all the views, but only the sign on page.

I can't migrate to JSF2 (for budget reasons).

I have this configuration:

javax.faces.STATE_SAVING_METHOD = server

that I can't change (we have a limited bandwith and mechanisms that block http request bigger than a small form page with very limited input fields.

Any idea?

Upvotes: 2

Views: 398

Answers (1)

pmartin8
pmartin8

Reputation: 1584

I couldn't get my login page out of the JSF context because there is a whole bunch of behaviors in my login page that depend on the JSF context.

I finally worked around the problem with a dirty hack. In a RestoreViewPhase listener, I detected that the current view has expired and I get all the parameters out of the HTTP request and into a session managed bean.

Then, when I get back to the login page, some javascript automatically resubmit the form along with a fresh view.

Pretty hacky but it works.

Upvotes: 1

Related Questions