This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes JSF and the fly likes IE refresh button problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "IE refresh button problem" Watch "IE refresh button problem" New topic
Author

IE refresh button problem

sonia pandit
Ranch Hand

Joined: Apr 19, 2008
Posts: 137
When I click on the refresh in IE7, it causes a submit to happen(an apply button). Is this event called Post-back and can it be prevented?

Thanks in advance,

Veena
Duc Vo
Ranch Hand

Joined: Nov 20, 2008
Posts: 254
Well, there is a solution for your problem. It's called PRG Pattern.
sonia pandit
Ranch Hand

Joined: Apr 19, 2008
Posts: 137
How do I do something like this in JSF:

The article says:
"Prohibit caching of application pages. Insert



in your pages. A page would be considered expired right after it loaded from the server."

Does this mean that if I prevent caching, the double submit problem will be solved?

Thanks.
Duc Vo
Ranch Hand

Joined: Nov 20, 2008
Posts: 254
sonia pandit wrote:
Does this mean that if I prevent caching, the double submit problem will be solved?

No, preventing caching has nothing to do with your problem.

When you refresh a webpage, the browser will ask the server for the page. If it was originally requested via POST method, the browser will send a POST request to the server for page, hence the problem. Now the solution is to Redirect the browser to another page using GET request, normally this page only displays result from the previous POST request, hence the pattern name Post-Redirect-Get (PRG Pattern). Have you tried the google link that I included in my previous post? You may want to ask JSF as another keyword as well.

Hope it help,

Duc
sonia pandit
Ranch Hand

Joined: Apr 19, 2008
Posts: 137
Yes, thanks I read the PRG link. I understand that if you redirect a post request to a get request you can overcome double submit problems. But that is thoretically, I don't understand how to implement it in practice. In addition, we are not using Struts. We are using JSF.

Veena.
Duc Vo
Ranch Hand

Joined: Nov 20, 2008
Posts: 254
What about this one http://www.google.com/search?q=PRG+pattern+%2BJSF
sonia pandit
Ranch Hand

Joined: Apr 19, 2008
Posts: 137
I dropped the Listener class in our package, configured it in the faces-config.xml and it worked like a charm. Great!

Thanks,

Veena
sonia pandit
Ranch Hand

Joined: Apr 19, 2008
Posts: 137
I do have one problem, after testing I found that the dialog page to which the navigation occurs if there is validations, does not pop up. This could be the change I made with the listener and the faces-config.xml. Any ideas?

Thanks,

Veena
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: IE refresh button problem