세션을 검사하는 필터가 있습니다. 내 필터 :세션이 만료 된 후 Primefaces 구성 요소가 응답하지 않습니다.
public class FilterLogin implements Filter{
FilterConfig fc;
@Override
public void init(FilterConfig filterConfig) throws ServletException {
//throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
fc = filterConfig;
}
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
//throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
HttpServletRequest req = (HttpServletRequest) request;
HttpServletResponse resp = (HttpServletResponse) response;
HttpSession session = req.getSession(true);
if (session.getAttribute("loginMB") == null) {
resp.sendRedirect("/home.xhtml");
} else {
chain.doFilter(request, response);
}
}
@Override
public void destroy() {
//throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
}
의 web.xml은 :
<filter>
<filter-name>filter</filter-name>
<filter-class>pl.ePrzychodnia.filter.LoginFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>filter</filter-name>
<url-pattern>/protected/*</url-pattern>
</filter-mapping>
<error-page>
<exception-type>javax.faces.application.ViewExpiredException</exception-type>
<location>/home.xhtml</location>
</error-page>
세션이 만료 될 때 나는 사이트 home.xhtml로 이동합니다. 하지만 세션이 만료되고 페이지의 탐색 메뉴를 클릭하면 구성 요소가 클릭에 반응하지 않습니다. Primefaces를 사용하지 않으면 모든 것이 올바르게 작동합니다. 내 프로젝트에서 primefaces를 사용할 때이 오류가 발생합니다. 그 원인은 무엇일까요?
나는 전역 예외 처리기를 사용하려고하지만 약간 문제가있다. 이 사이트 http://wmarkito.wordpress.com/2012/04/05/adding-global-exception-handling-using-jsf-2-x-exceptionhandler/
에서 클래스를 복사 클래스 CustomExceptionHandler 편집 : 나는 변경
try {
//log error ?
log.log(Level.SEVERE, "Critical Exception!", t);
//redirect error page
requestMap.put("exceptionMessage", t.getMessage());
nav.handleNavigation(fc, null, "/home");
fc.renderResponse();
// remove the comment below if you want to report the error in a jsf error message
//JsfUtil.addErrorMessage(t.getMessage());
}
: nav.handleNavigation(fc, null, "/error");
nav.handleNavigation(fc, null, "/home");
에 그러나 세션 시간 제한 내가 페이지를 home.xhtml하는 reditect하지 않을 경우에만 이동 클릭하면 예제 오류가 발생했습니다.
SEVERE: Critical Exception!
javax.faces.application.ViewExpiredException: viewId:/protected/admin/about.xhtml - View /protected/admin/about.xhtml could not be restored.
내가 abou 내 세션이 만료되었을 때 t 페이지. 불완전한 about.xhtml 페이지가 home.xhtml이 표시됩니다.
당신이 오류 메시지를지고의 FullAjaxExceptionHandler 기능을 사용할 수 있습니까? 어떤 주요면과 JSF 버전? – Andy
primefaces [idleMonitor] (http://www.primefaces.org/showcase/ui/idlemonitorHome.jsf)를 시도 할 수 있습니다. – landal79
멈추는 위치에 xhtml 부분을 게시하십시오. – Andy