Clear Cache and Refresh Page with Timestamp Query Parameter in Java
To clear the cache and refresh the page, you can append a timestamp or a random number as a query parameter to the URL. This will force the browser to retrieve the latest version of the page from the server.
Here's an example of how you can modify the code to achieve this:
String timestamp = String.valueOf(System.currentTimeMillis());
response.sendRedirect(basePath + "index.jsp?timestamp=" + timestamp);
This will append the current timestamp as a query parameter to the URL, ensuring that the page is always fetched from the server and not from the cache.
原文地址: https://www.cveoy.top/t/topic/psfw 著作权归作者所有。请勿转载和采集!