JSF中的空白页
时间:2020-03-06 14:37:37 来源:igfitidea点击:
如果我的代码引发异常,有时jsf有时不会每次都显示空白页。我正在使用facelets进行布局。
在Sun Sun讨论区的帖子中报告了类似的错误,但没有答案。
还有其他人遇到相同问题或者有解决方案吗?
;)
由于某些要求。这里跟随更多的datails:
web.xml
<error-page> <exception-type>com.company.ApplicationResourceException</exception-type> <location>/error.faces</location> </error-page>
在真正的异常之后,将打印与jsf相关的堆栈:
####<Sep 23, 2008 5:42:55 PM GMT-03:00> <Error> <HTTP> <comp141> <AdminServer> <[ACTIVE] ExecuteThread: '3' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1222202575662> <BEA-101107> <[weblogic.servlet.internal.WebAppServletContext@6d46b9 - appName: 'ControlPanelEAR', name: 'ControlPanelWeb', context-path: '/Web'] Problem occurred while serving the error page. javax.servlet.ServletException: viewId:/error.xhtml - View /error.xhtml could not be restored. at javax.faces.webapp.FacesServlet.service(FacesServlet.java:249) at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:226) at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:124) at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:283) at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:175) at weblogic.servlet.internal.RequestDispatcherImpl.invokeServlet(RequestDispatcherImpl.java:525) at weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:261) at weblogic.servlet.internal.ForwardAction.run(ForwardAction.java:22) at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321) at weblogic.security.service.SecurityManager.runAs(Unknown Source) at weblogic.servlet.internal.ErrorManager.handleException(ErrorManager.java:144) at weblogic.servlet.internal.WebAppServletContext.handleThrowableFromInvocation(WebAppServletContext.java:2201) at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2053) at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1366) at weblogic.work.ExecuteThread.execute(ExecuteThread.java:200) at weblogic.work.ExecuteThread.run(ExecuteThread.java:172) javax.faces.application.ViewExpiredException: viewId:/error.xhtml - View /error.xhtml could not be restored. at com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:180) at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:248) at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117) at javax.faces.webapp.FacesServlet.service(FacesServlet.java:244) at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:226) at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:124)
我使用的是jsf版本Mojarra 1.2_09,richfaces 3.2.1.GA和facelets 1.1.13.
希望有所帮助:(
解决方案
我认为这很大程度上取决于JSF实施。我听说有些会呈现空白屏幕。
我们使用的那个会在堆栈跟踪中抛出错误500。对于其他用户,超时按钮将无法正常工作。这都是在我们的开发阶段。
但是我能为我们提供的最佳建议是捕获异常并将它们记录在错误日志中,以便我们拥有堆栈跟踪以供以后调试。对于像后端失败那样我们无能为力的消息,我们只向屏幕上显示的FacesContext添加一条致命消息,并记录堆栈跟踪。