Jsf 2 如果不支持,您可能需要为此使用自定义的UIForm呈现程序或一些JS/jQuery,或者只是将其添加到各个输入元素中。另请参见,您不应该使用POST进行导航。 <dependency> <groupId>org.glassf
Jsf 2 如果不支持,您可能需要为此使用自定义的UIForm呈现程序或一些JS/jQuery,或者只是将其添加到各个输入元素中。另请参见,您不应该使用POST进行导航。 <dependency> <groupId>org.glassf,jsf-2,back-button,Jsf 2,Back Button,如果不支持,您可能需要为此使用自定义的UIForm呈现程序或一些JS/jQuery,或者只是将其添加到各个输入元素中。另请参见,您不应该使用POST进行导航。 <dependency> <groupId>org.glassfish</groupId> <artifactId>javax.faces</artifactId> <version>2.1.3</version> <
如果
不支持,您可能需要为此使用自定义的UIForm
呈现程序或一些JS/jQuery,或者只是将其添加到各个输入元素中。另请参见,您不应该使用POST进行导航。
<dependency>
<groupId>org.glassfish</groupId>
<artifactId>javax.faces</artifactId>
<version>2.1.3</version>
<scope>compile</scope>
</dependency>
@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)) { // Skip JSF resources (CSS/JS/Images/etc)
res.setHeader("Cache-Control", "no-cache, no-store, must-revalidate"); // HTTP 1.1.
res.setHeader("Pragma", "no-cache"); // HTTP 1.0.
res.setDateHeader("Expires", 0); // Proxies.
}
chain.doFilter(request, response);
}
@Named("browserCacheController")
@RequestScoped
public class BrowserCacheController implements Serializable {
private static final long serialVersionUID = 1L;
/**
* Returns a unique increasing id for each request
* @return
*/
public long getCacheID() {
return System.currentTimeMillis();
}
}
<script type="text/javascript">
// check for latestCacheID
if (!isValidCacheID(#{browserCacheController.cacheID})) {
//redirect to some page
document.location="#{facesContext.externalContext.requestContextPath}/index.jsf";
}
// test cacheID if it comes from the server....
function isValidCacheID(currentCacheID) {
if (!('localStorage' in window && window['localStorage'] !== null))
return true; // old browsers not supported
var latestCacheID=localStorage.getItem("org.imixs.latestCacheID");
if (latestCacheID!=null && currentCacheID<=latestCacheID) {
return false; // this was a cached browser page!
}
// set new id
localStorage.setItem("org.imixs.latestCacheID", currentCacheID);
return true;
}
</script>