2012-10-24 44 views
1

我想一些JSF添加到我的訪問Spring WebFlow項目,我做了一些改動試圖在以下細節:試圖JSF添加到我的訪問Spring WebFlow項目,現在我的Webflow將不能正常工作

http://static.springsource.org/spring-webflow/docs/2.3.x/reference/html/ch13s07.html

但現在我的webflow項目將無法正常工作。

這裏是我的工作老flow.xml文件:

<?xml version="1.0" encoding="UTF-8"?> 
<beans xmlns="http://www.springframework.org/schema/beans" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xmlns:flow="http://www.springframework.org/schema/webflow-config" 
xmlns:p="http://www.springframework.org/schema/p" 
xmlns:context="http://www.springframework.org/schema/context" 
xsi:schemaLocation="http://www.springframework.org/schema/webflow-config 
    http://www.springframework.org/schema/webflow-config/spring-webflow-config-2.3.xsd 
    http://www.springframework.org/schema/beans 
    http://www.springframework.org/schema/beans/spring-beans-3.0.xsd 
    http://www.springframework.org/schema/context 
    http://www.springframework.org/schema/context/spring-context-3.0.xsd"> 

<bean id="validator" class="org.springframework.validation.beanvalidation.LocalValidatorFactoryBean" /> 

    <!-- Executes flows: the entry point into the Spring Web Flow system --> 
    <flow:flow-executor id="flowExecutor" /> 

    <!-- The registry of executable flow definitions --> 
    <flow:flow-registry id="flowRegistry" 
      flow-builder-services="flowBuilderServices" 
      base-path="/WEB-INF/flows"> 
    <flow:flow-location-pattern value="/**/*-flow.xml" /> 
    </flow:flow-registry> 


<flow:flow-builder-services id="flowBuilderServices" 
      view-factory-creator="mvcViewFactoryCreator" 
      validator="validator" 
      /> 


    <bean id="mvcViewFactoryCreator" class= 
     "org.springframework.webflow.mvc.builder.MvcViewFactoryCreator"> 
    <property name="defaultViewSuffix" value=".jsp" /> 
    </bean> 

    <!--Maps request paths to flows in the flowRegistry--> 
    <bean class="org.springframework.webflow.mvc.servlet.FlowHandlerMapping"> 
    <property name="flowRegistry" ref="flowRegistry" /> 
    </bean> 

    <!-- 
    Dispatches requests mapped to flows to FlowHandler implementations 
    --> 
    <bean class="org.springframework.webflow.mvc.servlet.FlowHandlerAdapter"> 
    <property name="flowExecutor" ref="flowExecutor" /> 
    </bean> 

</beans> 

現在,這裏是我的新flow.xml文件不起作用:

<?xml version="1.0" encoding="UTF-8"?> 
<beans xmlns="http://www.springframework.org/schema/beans" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns:webflow="http://www.springframework.org/schema/webflow-config" 
    xmlns:faces="http://www.springframework.org/schema/faces" 
    xsi:schemaLocation=" 
     http://www.springframework.org/schema/beans 
     http://www.springframework.org/schema/beans/spring-beans-3.0.xsd 
     http://www.springframework.org/schema/webflow-config 
     http://www.springframework.org/schema/webflow-config/spring-webflow-config-2.3.xsd 
     http://www.springframework.org/schema/faces 
     http://www.springframework.org/schema/faces/spring-faces-2.2.xsd"> 

    <!-- Executes flows: the central entry point into the Spring Web Flow system --> 
    <webflow:flow-executor id="flowExecutor"> 
     <webflow:flow-execution-listeners> 
      <webflow:listener ref="facesContextListener"/> 
     </webflow:flow-execution-listeners> 
    </webflow:flow-executor> 

    <!-- The registry of executable flow definitions --> 
    <webflow:flow-registry id="flowRegistry" flow-builder-services="flowBuilderServices" base-path="/WEB-INF"> 
     <webflow:flow-location-pattern value="**/*-flow.xml" /> 
    </webflow:flow-registry> 

    <!-- Configures the Spring Web Flow JSF integration --> 
    <faces:flow-builder-services id="flowBuilderServices" /> 

    <!-- A listener maintain one FacesContext instance per Web Flow request. --> 
    <bean id="facesContextListener" 
     class="org.springframework.faces.webflow.FlowFacesContextLifecycleListener" /> 

</beans> 

現在for my faces-config.xml文件:

<?xml version='1.0' encoding='UTF-8'?> 
<faces-config xmlns="http://java.sun.com/xml/ns/javaee" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd" 
    version="2.0"> 

    <application> 
     <el-resolver>org.springframework.web.jsf.el.SpringBeanFacesELResolver</el-resolver> 
    </application> 

</faces-config> 

那麼有人可以告訴我爲什麼webflow停止工作!

回答

0

我想你正試圖加載faces-config.xml作爲Spring配置文件。 JSF配置文件(faces-config.xml)是註冊JSF應用程序資源的地方,它不是Spring配置文件,因此不要將其包含在其他Spring配置文件中。 另外/ WEB-INF文件夾是放置faces-config.xml的默認位置。如果您在/ WEB-INF/spring文件夾擁有它,那麼你需要提及在web.xml中像這樣的路徑:

<context-param> 
    <param-name>javax.faces.CONFIG_FILES</param-name> 
    <param-value> 
    /WEB-INF/faces/faces-config.xml 
    </param-value> 
</context-param> 

無關的具體問題,你在你的faces-還需要「SpringBeanFacesELResolver」 config.xml來解析任何Spring bean,然後將它們注入任何JSF管理的bean。

<faces-config> 
    <application> 
    <el-resolver>org.springframework.web.jsf.el.SpringBeanFacesELResolver</el-resolver> 
    </application> 
<faces-config> 
+0

仍然沒有工作 – techsjs2012

+0

我更新的問題與必須更新的信息 – techsjs2012

+0

你得到任何異常,不要在問題發生變化的代碼。放置更新部分並添加更改內容。 – Ravi

相關問題