Java

NAVIGATION
CATEGORIES
REFERRENCE
LINKS
  • Preventing struts Page Caching

    3 answers - 636 bytes - related search similar search Add To My Delicious Add To My Stumble Upon Add To My Google Mark Add To My Facebook Add To My Digg Add To My Reddit

    When i submit the page and hit the back button i can
    submit the page again. The browser is caching the jsp
    page. I have tried adding this code :
    response.setHeader("Cache-Control","no-store");
    response.setHeader("Pragma","no-cache");
    response.setDateHeader ("Expires", 0);
    to my jsp page but did not help.
    Any solution to this problem? Experts please help
    Start your day with Yahoo! - Make it your home page!
    http://www.yahoo.com/r/hs
    To unsubscribe, e-mail: user-unsubscribe (AT) struts (DOT) apache.org
    For additional commands, e-mail: user-help (AT) struts (DOT) apache.org
  • No.1 | | 896 bytes | |

    sma3har wrote:
    When i submit the page and hit the back button i can
    submit the page again. The browser is caching the jsp
    page. I have tried adding this code :

    response.setHeader("Cache-Control","no-store");
    response.setHeader("Pragma","no-cache");
    response.setDateHeader ("Expires", 0);
    to my jsp page but did not help.

    Any solution to this problem? Experts please help

    What problem, exactly? How is page caching related to resubmitting the
    page? Those are separate issues.

    Do you want to prevent the page from being cached, so that when you hit
    the back button the page is re-rendered with fresh data? do you just
    want to prevent the same form being submitted twice?

    L.

    To unsubscribe, e-mail: user-unsubscribe (AT) struts (DOT) apache.org
    For additional commands, e-mail: user-help (AT) struts (DOT) apache.org
  • No.2 | | 1054 bytes | |

    12/5/05, sma3har <sma3har (AT) yahoo (DOT) comwrote:
    When i submit the page and hit the back button i can
    submit the page again. The browser is caching the jsp
    page. I have tried adding this code :

    response.setHeader("Cache-Control","no-store");
    response.setHeader("Pragma","no-cache");
    response.setDateHeader ("Expires", 0);
    to my jsp page but did not help.

    Any solution to this problem? Experts please help

    Add "no-cache" to cache-control header like this:
    response.setHeader("Cache-Control","no-cache, no-store");

    Try to add "must-revalidate" header.

    What browser do you use? I hope you do not use

    BTW, Struts can mark all responses as non-cachable for you, use
    <controller nocache="true"/>. But remember that "no-store" appeared
    only in 1.2.4 (or 1.2.2?) "no-store" is important for Firefox.

    Michael.

    To unsubscribe, e-mail: user-unsubscribe (AT) struts (DOT) apache.org
    For additional commands, e-mail: user-help (AT) struts (DOT) apache.org
  • No.3 | | 2766 bytes | |

    Well, those are really two separate issues, though if you achieve the
    second you would no longer need to worry about the first. What you
    probably want, though, is for the user to be taken to the login page
    only if they've logged out (or their session has expired), in which case
    the first problem still applies.

    To redirect to a login page when the user hits back, you need to (a)
    disable page caching as discussed in this thread and (b) include a check
    in your actions (or using a servlet filter) to see if the session is
    valid and do the redirect if not.

    To avoid resubmits, there are a few options. The simplest is probably to
    use Struts' built-in support for transaction tokens. You include a token
    as part of the request when the form is submitted and, in the action
    that processes the submit, you check if the token is valid and reject
    the form submission if not.

    L.

    sma3har wrote:
    I would like to prevent submitting the page twice as
    well as when back button is pressed user should be
    taken to login page.

    Thanks

    Laurie Harper <laurie (AT) holoweb (DOT) netwrote:

    >sma3har wrote:

    When i submit the page and hit the back button i
    >can

    submit the page again. The browser is caching the
    >jsp

    page. I have tried adding this code :

    response.setHeader("Cache-Control","no-store");
    response.setHeader("Pragma","no-cache");
    response.setDateHeader ("Expires", 0);
    to my jsp page but did not help.

    Any solution to this problem? Experts please
    >help
    >>

    >What problem, exactly? How is page caching related
    >to resubmitting the
    >page? Those are separate issues.
    >>

    >Do you want to prevent the page from being cached,
    >so that when you hit
    >the back button the page is re-rendered with fresh
    >data? do you just
    >want to prevent the same form being submitted twice?
    >>

    >L.
    >>
    >>
    >>


    >To unsubscribe, e-mail:
    >user-unsubscribe (AT) struts (DOT) apache.org
    >For additional commands, e-mail:
    >user-help (AT) struts (DOT) apache.org
    >>
    >>


    Yahoo! DSL Something to write home about.
    Just $16.99/mo. or less.
    dsl.yahoo.com

    To unsubscribe, e-mail: user-unsubscribe (AT) struts (DOT) apache.org
    For additional commands, e-mail: user-help (AT) struts (DOT) apache.org

Re: Preventing struts Page Caching


max 4000 letters.
Your nickname that display:
In order to stop the spam: 7 + 6 =
QUESTION ON "Java"

EMSDN.COM