I have a backing bean (say MyPageBean) with request scope, but it seems to be in session because, navigating my applic开发者_StackOverflowation, when I visit the page myPage, I always get the same instance. I'm using JSF 1.2, IceFaces 1.8.2 and JBoss 5.1.0
Isn't it just your webbrowser or proxy which is aggressively caching the webpages?
Create a Filter
which does the following in doFilter()
method to instruct the client to not cache the HTTP response:
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);
and map it in web.xml
like follows:
<filter>
<filter-name>cacheFilter</filter-name>
<filter-class>com.example.CacheFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>cacheFilter</filter-name>
<servlet-name>facesServlet</servlet-name>
</filter-mapping>
assuming that you've mapped the FacesServlet
instance on <servlet-name>
of facesServlet
.
In ICEFaces request scope extends across partial submits. So if your application never refreshes the whole page, and uses only partial submits, you may encounter this.
Not using partial submit in the navigation should solve your problem.
精彩评论