JSP tips-prevent browsers from caching webpages

Source: Internet
Author: User

In order to accelerate users' browsing speed, browsers Usually retrieve browsed web pages to the hard drive. The next time they browse the same page, they will go to the hard drive to find them. However, the current web pages are dynamic, to prevent users from capturing expired data in the hard drive, JSP can use the following method to prevent the browser from caching the webpage. This method ensures that the user can always see the latest data on this webpage.

1. JSP syntax
<%
Response. setHeader ("Pragma", "no-cache ");
Response. setHeader ("Cache-Control", "no-cache ");
Response. setDateHeader ("Expires", 0 );
%>

2. You can also use the following HTML syntax to use static Web pages.
<Meta http-equiv = "Pragma" content = "no-cache">
<Meta http-equiv = "Cache-Control" content = "no-cache">
<Meta http-equiv = "Expires" content = "0">
Note: These HTML syntax should be placed in the

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.