问题
I have one template.xhtml file at /template/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>
I have tabs.xhtml file at /tabs/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>
I am getting the following exception because of the ui include tag in template.xhtml. Is the src attribute of ui include is wrong.:
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)
回答1:
The ui:include
tag is working as expected. The problem is inside tabx.xhtml. For the menuitems your have outcome="index"
and my money is on the index.xhtml not in the same folder as tab.xhtml. Either make sure the outcome is a relative link like ../index
or make it absolute like /index
.
For further assistance you should post your directory structure.
来源:https://stackoverflow.com/questions/24797670/javax-faces-facesexception-could-not-resolve-navigationcase-for-outcome