`
peryt
  • 浏览: 56854 次
  • 来自: ...
最近访客 更多访客>>
社区版块
存档分类
最新评论
  • waiting: 既然都指定了dataType为'script'那就不必特别在b ...
    jQuery

9.1 about flash.now[:error] vs flash[:error]

 
阅读更多

There’s a subtle difference between flash and flash.now. The flash variable is designed to be used before a redirect, and it persists on the resulting page for one request—that is, it appears once, and disappears when you click on another link. Unfortunately, this means that if we don’t redirect, and instead simply render a page (as in Listing 9.8), the flash message persists for two requests: it appears on the rendered page but is still waiting for a “redirect” (i.e., a second request), and thus appears again if you click a link.

To avoid this weird behavior, when rendering rather than redirecting we use flash.nowinstead of flash. The flash.now object is specifically designed for displaying flash messages on rendered pages. If you ever find yourself wondering why a flash message is showing up where you don’t expect it, chances are good that you need to replace flash withflash.now.

 

分享到:
评论

相关推荐

    python3.6.5参考手册 chm

    Text Vs. Data Instead Of Unicode Vs. 8-bit Overview Of Syntax Changes New Syntax Changed Syntax Removed Syntax Changes Already Present In Python 2.6 Library Changes PEP 3101: A New Approach To ...

    Clever Internet Suite (SRC) v9.1.0.0

    Clever Internet Suite version 9.1 These Internet components give you everything you need to jumpstart your Internet development without any external dependencies. The suite of Internet Components ...

    C# Game Programming Cookbook for Unity 3D - 2014

    1.1.5 Where to Now?.............................................8 2. Building the Core Game Framework 9 2.1 Controllers and Managers............................................11 2.1.1 Controllers.......

    Python Tutorial 入门指南3.6英文版

    9.1. A Word About Names and Objects 91 9.2. Python Scopes and Namespaces 91 9.2.1. Scopes and Namespaces Example 94 9.3. A First Look at Classes 95 9.3.1. Class Definition Syntax 95 9.3.2. Class ...

    RAM清理软件htcAddictscleanRAM_1.7

    Version 1.0.4 - Fixed: about screen + small issue (nk.exe error msg) for htc touch pro users Version 1.0.3 - Added: all registry settings is now in the archive/installation file (cab) + new icon for ...

Global site tag (gtag.js) - Google Analytics