jsf-2 – javax.faces.FacesException:无法解析NavigationCase的结果

前端之家收集整理的这篇文章主要介绍了jsf-2 – javax.faces.FacesException:无法解析NavigationCase的结果前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我在/template/template.xhtml上有一个template.xhtml文件
<h:head>

</h:head>

<h:body>
    <p:layout fullPage="true">
        <p:layoutUnit position="north" size="100">
            <h:outputText value="header"></h:outputText>
        </p:layoutUnit>
        <p:layoutUnit position="center">
            <p:layout>
                <p:layoutUnit position="north">
                    <h:outputText value="tabs"/>
                    <ui:include src="/tabs/tabs.xhtml"/>
                </p:layoutUnit>
                <p:layoutUnit position="west">
                    <h:outputText value="left menu"></h:outputText>
                </p:layoutUnit>
                <p:layoutUnit position="center">
                    <h:outputText value="main-content"></h:outputText>
                </p:layoutUnit>
            </p:layout>
        </p:layoutUnit>
        <p:layoutUnit position="south" size="100">
            <h:outputText value="footer"></h:outputText>
        </p:layoutUnit>
    </p:layout>
</h:body>
</html>

我在/tabs/tabs.xhtml上有tabs.xhtml文件

<h:head>

</h:head>


<p:tabMenu activeIndex="#{param.i}">
    <p:menuitem value="Overview" outcome="index">
        <f:param name="i" value="0" />
    </p:menuitem>
    <p:menuitem value="Demos" outcome="index">
        <f:param name="i" value="1" />
    </p:menuitem>
    <p:menuitem value="Documentation" outcome="index">
        <f:param name="i" value="2" />
    </p:menuitem>
    <p:menuitem value="Support" outcome="index">
        <f:param name="i" value="3" />
    </p:menuitem>
    <p:menuitem value="Social" outcome="index">
        <f:param name="i" value="4" />
    </p:menuitem>
</p:tabMenu>

由于template.xhtml中的ui include标记,我得到以下异常.是否包含ui的src属性错误的:

javax.faces.FacesException: Could not resolve NavigationCase for outcome: index
at org.primefaces.renderkit.OutcoMetargetRenderer.getTargetURL(OutcoMetargetRenderer.java:86)
at org.primefaces.component.menu.BaseMenuRenderer.encodeMenuItem(BaseMenuRenderer.java:162)
at org.primefaces.component.tabmenu.TabMenuRenderer.encodeItem(TabMenuRenderer.java:89)
at org.primefaces.component.tabmenu.TabMenuRenderer.encodeMarkup(TabMenuRenderer.java:65)
at org.primefaces.component.menu.BaseMenuRenderer.encodeEnd(BaseMenuRenderer.java:108)
at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:879)
at org.primefaces.renderkit.CoreRenderer.renderChild(CoreRenderer.java:85)
at org.primefaces.renderkit.CoreRenderer.renderChildren(CoreRenderer.java:68)
at org.primefaces.component.layout.LayoutUnitRenderer.encodeEnd(LayoutUnitRenderer.java:49)
at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:879)
at org.primefaces.renderkit.CoreRenderer.renderChild(CoreRenderer.java:85)
at org.primefaces.renderkit.CoreRenderer.renderChildren(CoreRenderer.java:68)
at org.primefaces.renderkit.CoreRenderer.renderChild(CoreRenderer.java:83)
at org.primefaces.renderkit.CoreRenderer.renderChildren(CoreRenderer.java:68)
at org.primefaces.component.layout.LayoutUnitRenderer.encodeEnd(LayoutUnitRenderer.java:49)
at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:879)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1655)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1651)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1651)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1651)
at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:395)
at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:127)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:117)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:97)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:135)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:309)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:301)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3730)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3696)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2273)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2179)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1490)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:256)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:221)

解决方法

ui:include标签正在按预期工作.问题出在tabx.xhtml中.对于menuitems,你有结果=“索引”,我的钱在index.xhtml上,不在tab.xhtml的同一个文件夹中.要么确保结果是像../index这样的相对链接,要么使它像/ index一样绝对.

要获得进一步的帮助,您应该发布目录结构.

原文链接:https://www.f2er.com/java/130027.html

猜你在找的Java相关文章