开发者

A F5 or Refresh calling in the page is a postback?

I would want to kn开发者_JAVA百科ow actually what is a F5 event for RichFaces ?

I have found other interesting article:

How to know if I am in a postback?


It depends.

Normally, fetching a page is a GET request, and F5 just does another GET. You can not detect 'F5', but instead should detect if the request is 'GET' or 'POST'.

If you fill out a form, and click "submit", and then do an F5 after that, you will typically get a warning from your browser because it will do another POST.

For instance, Firefox will say: "To display this page, Firefox must send information that will repeat any action (such as a search or order confirmation) that was performed earlier. [Resend] [Cancel]"

Thus, an F5 might be either a GET or POST, and you need to be able to deal with either.

One way to keep your users from getting this message from their browser is to use the Post/Redirect/Get idiom.

It can be confusing when using some web frameworks, because things that don't look like form submit buttons (causing a POST) actually are. For instance, in ASP.NET, clicking a link might do a postback, where normally that is not the case.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜