JSF - Fields of my backbean are not cleaned even after exiting the application

后端 未结 1 2016
攒了一身酷
攒了一身酷 2021-01-25 14:37

I\'m a beginner in JSF and I´m having the following problem: I have a view with a backbean that I fill some values ​​to perform a search and display results. When I go out and r

相关标签:
1条回答
  • 2021-01-25 15:22

    You're likely facing a page from the browser cache. You need to instruct the browser to not cache the JSF pages. This is the best to be achieved by a Filter which is mapped on an URL pattern of interest (*.jsf for example) and does the following job in doFilter() method.

    HttpServletResponse hsr = (HttpServletResponse) response;
    hsr.setHeader("Cache-Control", "no-cache, no-store, must-revalidate"); // HTTP 1.1.
    hsr.setHeader("Pragma", "no-cache"); // HTTP 1.0.
    hsr.setDateHeader("Expires", 0); // Proxies.
    chain.doFilter(request, response);
    
    0 讨论(0)
提交回复
热议问题