[jboss-user] [JBoss Seam] - Re: How to prevent page data reloading when click Back

arvhatte do-not-reply at jboss.com
Fri Feb 1 04:17:17 EST 2008

Hi gus888,

By default your browser shows you a page from its cache when you press the back button in your browser, except when that page has accepted POSTDATA, so was requested with the POST method instead of the GET method. The POST method is (generally) used when submitting form data en the GET method is (generally) used when simply retrieving information. In Seam the POST method is also used to propagate the conversation id (see http://labs.jboss.com/jbossseam/faq/#get, so if you try to go back to a page where you posted data or when in a conversation scope, your browser will try to re-post the data and therefore hit your server again, causing your data to be reloaded.

You can of course prevent this by making use of 'redirect' in your pages.xml to redirect to the new page after the POST is finished (basically accepting the POST, and then doing a new GET request to the new page). Another approach might be by storing data in a wider scope, which would still make a call to the server (when pressing the back button), but because the data is still present, it won't refetch that data from the database.

Hope this was helpful, if not, please let me know by replying again. If possible, also include your pages.xml and the two backing beans of the pages you're navigating between by using the back button.


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4125411#4125411

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4125411

More information about the jboss-user mailing list