/template/template.xhtmlに1つの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のi includeタグが原因で、次の例外が発生します。 ui includeの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の内部にあります。メニュー項目については、outcome="index"
があり、私のお金はtab.xhtmlと同じフォルダーではなくindex.xhtmlにあります。結果が../index
のような相対リンクであることを確認するか、/index
のように絶対リンクにします。
さらに支援が必要な場合は、ディレクトリ構造を投稿する必要があります。