我正在使用jsf2和primefaces 3.5 spring webflow。 我的索引页面不显示菜单栏(由模型创建)子菜单和项目。虽然webflow上的页面显示菜单栏。
我的代码如下
根上下文
<mvc:annotation-driven />
<mvc:resources mapping="/" location="/resources/**"/>
<faces:resources />
<import resource="controller.xml"/>
<import resource="webflow.xml"/>
<context:component-scan base-package="com.test.testapp"/>
<bean id="faceletsViewResolver" class="org.springframework.web.servlet.view.UrlBasedViewResolver">
<property name="viewClass" value="org.springframework.faces.mvc.JsfView"/>
<property name="prefix" value="/WEB-INF/views/" />
<property name="suffix" value=".xhtml" />
</bean>
<mvc:annotation-driven />
<mvc:resources mapping="/" location="/resources/**"/>
<faces:resources />
<import resource="controller.xml"/>
<import resource="webflow.xml"/>
<context:component-scan base-package="com.test.testapp"/>
<bean id="faceletsViewResolver" class="org.springframework.web.servlet.view.UrlBasedViewResolver">
<property name="viewClass" value="org.springframework.faces.mvc.JsfView"/>
<property name="prefix" value="/WEB-INF/views/" />
<property name="suffix" value=".xhtml" />
</bean>
的Webflow 的
thanks the index
the template
<bean class="org.springframework.webflow.scope.ScopeRegistrar"/>
<webflow:flow-executor id="flowExecutor" flow-registry="flowRegistry">
<webflow:flow-execution-listeners>
<webflow:listener ref="facesContextListener"/>
</webflow:flow-execution-listeners>
</webflow:flow-executor>
<bean id="facesContextListener" class="org.springframework.faces.webflow.FlowFacesContextLifecycleListener"/>
<webflow:flow-registry id="flowRegistry" flow-builder-services="facesFlowBuilderServices" base-path="/WEB-INF/pages">
<webflow:flow-location-pattern value="/**/*-flow.xml" />
</webflow:flow-registry>
<faces:flow-builder-services id="facesFlowBuilderServices" development="true" />
<bean id="mvcViewFactoryCreator" class="org.springframework.webflow.mvc.builder.MvcViewFactoryCreator"/>
<bean class="org.springframework.faces.webflow.JsfFlowHandlerAdapter">
<property name="flowExecutor" ref="flowExecutor" />
</bean>
<bean class="org.springframework.webflow.mvc.servlet.FlowHandlerMapping">
<property name="flowRegistry" ref="flowRegistry"/>
<property name="order" value="0"/>
</bean>
Controller
<mvc:view-controller path="/index" view-name="index" />
<mvc:view-controller path="/login" view-name="login" />
<context:component-scan base-package="com.test.testapp.Controller"/>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui"
template="/WEB-INF/layout/layout.xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html">
<p:menubar model="#{mainMenuModel.model}"/>
<ui:define name="content">
</ui:define>
</ui:composition>
<h:body styleClass="body">
<h:form id="contentForm">
<ui:insert name="menu"/>
<ui:insert name="content"/>
</h:form>
</h:body>