JSF/ADF and the browsers’ back button

When you’re developing a JSF or ADF Faces application and your giving your customer a first testing-experience, you’ll notice the browser’s back button is a very interesting functionality used by a lot of end-users.

JSF saves the state of every page loaded in a browser, which means everytime a user clicks the browser back button, JSF loads the saved state of the target page.

You will also notice that the application is behaving very weard and unpredictable and you as a developer will need to solve the problem.

Possible solutions:

  1. Integrate the needed java script functionality to display the application in a full screen window (back button isn’t displayed anymore)
  2. Define no-caching on your web application using the phaselistener (jsf api’s)
  3. The user needs to refresh the page he ‘backed to’ => maybe this isn’t an option when I’m talking about developers and customers ;o)
  4. Use ‘enableTokenValidation=false’ within an ADF Application
  5. Define the needed state- and session-parameters in your jsf’s configuration file, read following post

I still think, when talking to collegues, browsing the internet/communities etc., you need to tell the customer that when using the back button, unexpected behaviour can occure in the application. Using bread-crumbs, task-oriented applications, separate crud-pages, etc. the customer won’t be that easily temped to use the back-button.


4 thoughts on “JSF/ADF and the browsers’ back button

  1. You could take a look at some frameworks that support “continuations”. This is very known issue and there are already some java frameworks out there that support this (Rife,Spring WebFlow).regardsB

  2. Could you elaborate on ‘continuations’, will this hook into the page lifecycle of JSF to prevent an incorrect state?

  3. I don’t think continuations is supported in JSF. Rife and Spring WebFlow do support this upto a certain point.There aren’t many Java frameworks out there who support it. But it is worth reading the basic concept. Even if it is not (yet) supported in JSF.

  4. including afh:body onload=”history.forward()” worked for us.

    When the user presses the back button he is immediatly forwarded to his “current” page. It needed some testing, but when you take this solution into account in your screen design it seems to handle 99% of the back button cases.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

About nathalieroman