简体   繁体   English

如何在数据库更新之间缓存JSP页面

[英]How Do I Cache A JSP Page Between DB Updates

I am writing a Java Spring web application that only updates the database every 15 minutes and was looking for ways to update the page only after every 15 minutes accordingly and serve the latest version of the page as response multiple times in between database updates. 我正在编写一个Java Spring Web应用程序,该应用程序仅每15分钟更新一次数据库,并且正在寻找相应的方法,以便仅每15分钟更新一次页面,并在数据库更新之间多次响应时提供页面的最新版本。

In order words, I want the page to be dynamic & updated every 15 minutes when the DB changes but served as though it were a static page always. 换句话说,我希望页面是动态的,并且在数据库更改时每15分钟更新一次,但是好像总是一个静态页面。 How can I successfully prepare and cache a JSP page into a server side (x)html this manner? 如何以这种方式成功准备JSP页面并将其缓存到服务器端(x)html中?

The way to update JSP dynamically while not refreshing the page is to use AJAX. 不刷新页面而动态更新JSP的方法是使用AJAX。

You can basically use JavaScript to get the data and update the DOM(eg HTML element values) every 15 minutes. 您基本上可以使用JavaScript每15分钟获取一次数据并更新DOM(例如HTML元素值)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM