Try this code
Add this class "NoCacheFilter " in your project
@WebFilter(servletNames = { "Faces Servlet" })
public class NoCacheFilter implements Filter {
/**
* doFilter Method.
*
*
*
*
*
*
*
* @param request
* @param response
* @param chain
* @throws IOException
* @throws ServletException
*/
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException,
ServletException {
HttpServletRequest req = (HttpServletRequest) request;
HttpServletResponse res = (HttpServletResponse) response;
if (!req.getRequestURI().startsWith(req.getContextPath() + ResourceHandler.RESOURCE_IDENTIFIER)) {
res.setHeader("Cache-Control", "no-cache, no-store, must-revalidate");
res.setHeader("Pragma", "no-cache");
res.setDateHeader("Expires", 0);
}
chain.doFilter(request, response);
}
/**
* Initial Method.
*
*
*
*
*
*
*
* @param filterConfig
* @throws ServletException
*/
@Override
public void init(FilterConfig filterConfig) throws ServletException {
}
/**
* Destroy Method.
*
*
*
*
*
*
*
*/
@Override
public void destroy() {
}
}
https://eclipse.googlesource.com/eclipselink/examples/mysports/+/b37750abf978fc8daee30ef4c214cf88857371b3/admin.web/src/main/java/eclipselink/example/mysports/admin/jsf/NoCacheFilter.java