The method of implementing masking browser cache by JSP _jsp programming

Source: Internet
Author: User
Tags browser cache

This article describes the JSP implementation of masking browser cache method. Share to everyone for your reference, specific as follows:

Many times because the browser's buffer often causes the page not to load immediately, so that the data error, then in the JSP, set the following lines of code, each page open browser will be again read from the server data, to ensure that the data on the browser to see the latest.

By setting the response header, you can allow browsers and proxy servers to not cache pages.

Method One:

<%
 Response.AddHeader ("Pragma", "No-cache");
 Response.setheader ("Cache-control", "No-cache, No-store, must-revalidate");
 Response.AddHeader ("Cache-control", "pre-check=0, post-check=0");
 Response.setdateheader ("Expires", 0);
%>

Method Two:

<%@ taglib uri= "orataglib" prefix= "ora"%>
<ora:noCache/>

I hope this article will help you with JSP program design.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.