日期:2014-05-16 浏览次数:20399 次
<error-page> <exception-type>javax.faces.application.ViewExpiredException</exception-type> <location>/sessionExpired.jsp</location> </error-page>
<%@page contentType="text/html" pageEncoding="UTF-8"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <%@include file="/WEB-INF/jspf/taglibs.jspf" %> <c:redirect url="/login.jsf" />
<error-page> <exception-type>javax.faces.application.ViewExpiredException</exception-type> <location>/sessionExpired.jsp</location> </error-page>
<%@page contentType="text/html" pageEncoding="UTF-8"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <%@include file="/WEB-INF/jspf/taglibs.jspf" %> <c:redirect url="/login.jsf" />
package trackingmap; import com.sun.faces.lifecycle.LifecycleImpl; import javax.faces.FacesException; import javax.faces.context.FacesContext; import javax.servlet.http.HttpServletResponse; /** * * @author chenwq */ public class TeleLifecycleImpl extends LifecycleImpl{ /** Creates a new instance of TeleLifecycleImpl */ public TeleLifecycleImpl() { super(); } public void execute(FacesContext context) throws FacesException{ try{ super.execute(context); }catch(javax.faces.application.ViewExpiredException e){ System.out.println("catch ViewExpiredException here"); try{ context.responseComplete(); context.renderResponse(); HttpServletResponse response = (HttpServletResponse) context.getExternalContext().getResponse(); String url = context.getExternalContext().getRequestContextPath() + "/faces/Login.jsp";///sessionExpired.jsp"; response.sendRedirect(url); }catch(Exception e1){ System.out.println("url redirect wrong "); } //throw e; }catch(FacesException ex){ throw ex; } } } package trackingmap; import com.sun.faces.lifecycle.LifecycleFactoryImpl; import javax.faces.lifecycle.Lifecycle; /** * * @author chenwq */ public class TeleLifecycleFactoryImpl extends LifecycleFactoryImpl { public final static String CUSTOM_LIFECYCLE = "TELEEPOCH"; /** Creates a new instance of TeleLifecycleFactoryImpl */ public TeleLifecycleFactoryImpl() { addLifecycle(CUSTOM_LIFECYCLE,new TeleLifecycleImpl()); } }
<factory> <lifecycle-factory>trackingmap.TeleLifecycleFactoryImpl</lifecycle-factory> </factory>
<context-param> <param-name>javax.faces.LIFECYCLE_ID</param-name> <param-value>TELEEPOCH</param-value> </context-param>