JSF 页面导航:意外的 RuntimeException
Posted
技术标签:
【中文标题】JSF 页面导航:意外的 RuntimeException【英文标题】:JSF Page Navigation: Unexpected RuntimeException 【发布时间】:2011-06-26 09:25:24 【问题描述】:我在 faces-config.xml 中定义了以下导航规则。我能够导航到第二页,但是从第二页到第一页,我无法导航。原因是什么,导航规则有什么问题?我想在没有重定向的情况下进行导航。
JSF 版本是 1.1
<navigation-rule>
<from-view-id>/first.jspx</from-view-id>
<navigation-case>
<from-action>#bean.setSelectedItem</from-action>
<from-outcome>form1</from-outcome>
<to-view-id>/second.jspx</to-view-id>
</navigation-case>
</navigation-rule>
<navigation-rule>
<from-view-id>/second.jspx</from-view-id>
<navigation-case>
<from-action>#bean2.testBack</from-action>
<from-outcome>form2</from-outcome>
<to-view-id>/first.jspx</to-view-id>
</navigation-case>
</navigation-rule>
从萤火虫我可以看到以下异常
java.lang.RuntimeException: no message available
谢谢
更新 1
我的 second.jspx 中的代码返回到 first.jspx
<ice:form id="form2">
<ice:commandLink action="#bean.testBack">
<h:outputText value="Test" />
</ice:commandLink>
</ice:form>
点击操作时的代码
public String testBack()
try
logger.info("invoked");
catch (Exception e)
e.printStackTrace();
return "form2";
堆栈跟踪
java.lang.RuntimeException: no message available
at com.icesoft.faces.webapp.http.servlet.MainServlet.service(MainServlet.java:173)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at com.icesoft.faces.webapp.xmlhttp.BlockingServlet.service(BlockingServlet.java:56)
at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:719)
at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:376)
at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:870)
at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:451)
at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:218)
at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.HttpRequestHandler.run(HttpRequestHandler.java:119)
at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.HttpRequestHandler.run(HttpRequestHandler.java:112)
at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
at oracle.oc4j.network.ServerSocketAcceptHandler.procClientSocket(ServerSocketAcceptHandler.java:230)
at oracle.oc4j.network.ServerSocketAcceptHandler.access$800(ServerSocketAcceptHandler.java:33)
at oracle.oc4j.network.ServerSocketAcceptHandler$AcceptHandlerHorse.run(ServerSocketAcceptHandler.java:831)
at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
at java.lang.Thread.run(Thread.java:595)
Caused by: java.lang.NullPointerException
at com.icesoft.faces.context.DOMResponseWriter.enhanceAndFixDocument(DOMResponseWriter.java:315)
at com.icesoft.faces.context.DOMResponseWriter.endDocument(DOMResponseWriter.java:186)
at com.icesoft.faces.application.D2DViewHandler.renderResponse(D2DViewHandler.java:496)
at com.icesoft.faces.application.D2DViewHandler.renderView(D2DViewHandler.java:153)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:87)
at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:117)
at com.icesoft.faces.webapp.http.core.JsfLifecycleExecutor.apply(JsfLifecycleExecutor.java:16)
at com.icesoft.faces.webapp.http.core.ReceiveSendUpdates.renderCycle(ReceiveSendUpdates.java:114)
at com.icesoft.faces.webapp.http.core.ReceiveSendUpdates.service(ReceiveSendUpdates.java:66)
at com.icesoft.faces.webapp.http.core.RequestVerifier.service(RequestVerifier.java:28)
at com.icesoft.faces.webapp.http.common.standard.PathDispatcherServer.service(PathDispatcherServer.java:24)
at com.icesoft.faces.webapp.http.servlet.MainSessionBoundServlet.service(MainSessionBoundServlet.java:160)
at com.icesoft.faces.webapp.http.servlet.SessionDispatcher$1.service(SessionDispatcher.java:42)
at com.icesoft.faces.webapp.http.servlet.ThreadBlockingAdaptingServlet.service(ThreadBlockingAdaptingServlet.java:18)
at com.icesoft.faces.webapp.http.servlet.EnvironmentAdaptingServlet.service(EnvironmentAdaptingServlet.java:63)
at com.icesoft.faces.webapp.http.servlet.SessionDispatcher.service(SessionDispatcher.java:62)
at com.icesoft.faces.webapp.http.servlet.SessionVerifier.service(SessionVerifier.java:22)
at com.icesoft.faces.webapp.http.servlet.PathDispatcher.service(PathDispatcher.java:23)
at com.icesoft.faces.webapp.http.servlet.MainServlet.service(MainServlet.java:153)
【问题讨论】:
你的规则很好。请发布有关代码和异常堆栈跟踪的更多详细信息(您应该在服务器日志中看到,而不是 Firebug)。 @BalusC 代码和上面添加的堆栈跟踪。 这是 IceFaces 特定的错误/问题。我将添加icefaces
标签。
@BalusC 这可能是一个 icefaces 错误。我注意到同一段代码在家庭环境中工作,但在办公室不是这样。这与代理有关吗?在家里我没有任何代理设置。!
【参考方案1】:
你可以试试这个:(我从我的项目中复制了这个,所以请更改值;-))
<navigation-rule>
<from-view-id>/pages/registration.jspx</from-view-id>
<navigation-case>
<from-outcome>next</from-outcome>
<to-view-id>/pages/registration.jspx</to-view-id>
</navigation-case>
<navigation-rule>
或者你有什么特别的原因为什么要使用这个标签?
<from-action>#bean.setSelectedItem</from-action>
【讨论】:
是的,没有以上是关于JSF 页面导航:意外的 RuntimeException的主要内容,如果未能解决你的问题,请参考以下文章