The views expressed on this blog are my own and do not necessarily reflect the views of Oracle.

Tuesday, April 28, 2009

Avoiding Back button mishaps in ADF

In ADF, it is pretty difficult to handle browser back button press. This may lead to unwanted/ unexpected behavior. In simplest wordings the reason could be out of sync iterators when browser back button is pressed. There are no good solutions to avoid it but you can certainly prevent the side effects in a graceful manner. There can be two ways to do so:

1. Set the screen size so that back button is not visible at all.
2. Use enableTokenValidation in the application.

2nd solution deserves some attention and more details. Basically when you enable token validation for a page, that page is annonated with the current object for all the iterators used to render that page. This annonation is then submitted to the server along with any data. At that point the current object of the iterator is compared with the annotation. If they differs and exception is thrown. So, this way user can be prevented to see weired behavior.

To enable just go to page definition file and set the tokenValidation property to true.


Suresh Babu said...

Hi Vivek,

for the point #1 Set the screen size so that back button is not visible at all.

Even though back button is not visible for the browser. but there is option in right click menu for browser to perform back, forward and refresh.

We can also have F5 to refresh the browser

So, it won't solve the issue completely.

Anonymous said...

What a great web log. I spend hours on the net reading blogs, about tons of various subjects. I have to first of all give praise to whoever created your theme and second of all to you for writing what i can only describe as an fabulous article. I honestly believe there is a skill to writing articles that only very few posses and honestly you got it. The combining of demonstrative and upper-class content is by all odds super rare with the astronomic amount of blogs on the cyberspace.

Unknown said...

@Suresh true for point 1. But there are others things needed like disabling right click and few key strokes using javascript.

of course not a nice approach and should be avoided but then there are unavoidable situations in life.

Anonymous said...

So, in summary, in order to run an ADF application, you have to break the normal browser behaviour. Hmm.

Unknown said...

I dont see where normal behavior is broken for the back button?