You might check out the Token component in Shale.

http://people.apache.org/~craigmcc/shale-core-javadocs/org/apache/shale/component/Token.html

It is kind of similar to the synchronization token is Struts.




--- Begin Message --- I can't think of an elegant way to do what you want, but here's an inelegant way:

Add logic to your application to add a counting parameter to the query string of every URL (including those for form submission), so that every URL looks something like this:

http://yourserver/foo.jsf?pageCount=24&x=2&y=5

The parameter would be incremented by a filter, which would store a counter in the session and check the URL that's coming in.  If the URL's counter matches the count currently stored in the session when the filter fires, everything's fine and the filter need only increment the counter in the session so it can be used to create new URLs.  If the URL's counter doesn't match, you should be able to easily tell what the user did to make that happen and take some action.

Obviously, making sure all URLs are thusly modified is a pain, but it's the only way I can think of to do what you want to do, off the top of my head.

-Matt

On 5/9/05, Srikanth Madarapu <[EMAIL PROTECTED]> wrote:
Hi

  I have found a place where I could find if the user used the browser's navigation buttons. The "getSerializedViewFromServletSession" method of "JspStateManagerImpl" class knows the currentViewId and the savedViewId, if they are different user must have pressed the back or forward buttons of the browser. ( I am using myfaces 1.0.7).

But I still cannot tell if the user has pressed the back or forward button. I need to perform some action if the user pressed the back button. Is there any way to find that out ?

Any input is of great help, thanks in advance.

Srikanth


-----Original Message-----
From: Srikanth Madarapu
Sent: Monday, May 09, 2005 9:07 AM
To: MyFaces Discussion; Mike Kienenberger
Subject: RE: detecting back button

Thanks for the information, do you know any more details, like at what point I can trap the back button event using the state manager? Is there a request generated when the back button is pressed ?

Thanks
Srikanth

-----Original Message-----
From: Mike Kienenberger [mailto:[EMAIL PROTECTED]]
Sent: Friday, May 06, 2005 5:21 PM
To: MyFaces Discussion
Subject: Re: detecting back button

I haven't done this yet, but I believe you'd handle back button issues
with a custom StateManager.:

http://java.sun.com/j2ee/javaserverfaces/1.1_01/docs/api/javax/faces/application/StateManager.html

On 5/6/05, Srikanth Madarapu <[EMAIL PROTECTED] > wrote:
> Hi
>
>   Is there any way I can detect if the user clicked the browser's back button?  I need to take some action when user clicks the browser's back button.
>
> TIA
> -Srikanth Madarapu
>
>


--- End Message ---

Reply via email to