无法找到任何<webflow>标签</webflow>

时间:2014-04-07 17:43:10

标签: java spring spring-webflow-2

我想将webflow添加到网络中。我在pom.xml中有webflow依赖,我已经开始添加bean,但似乎无法找到任何标记,正如我在每个教程中看到的那样。我在servlet-context.xml中拥有所有bean,就是这样:

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


<!-- DispatcherServlet Context: defines this servlet's request-processing infrastructure -->

<!-- Enables the Spring MVC @Controller programming model -->
<annotation-driven />
<mvc:annotation-driven />
<!-- Handles HTTP GET requests for /resources/** by efficiently serving up static resources in the ${webappRoot}/resources directory -->
<resources mapping="/resources/**" location="/resources/" />

<!-- Resolves views selected for rendering by @Controllers to .jsp resources in the /WEB-INF/views directory -->
<beans:bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
    <beans:property name="prefix" value="/WEB-INF/views/" />
    <beans:property name="suffix" value=".jsp" />
</beans:bean>
    <!--  <beans:bean class="my.package.Controllers.LoginController"></beans:bean>-->
<!--  <beans:bean class="my.package.Controllers.NewUserFormController"></beans:bean>-->
<!--  <beans:bean class="my.package.Controllers.QueEsController"></beans:bean>-->
<beans:bean class="my.package.Services.UsuarioServiceImp"></beans:bean>
<beans:bean class="my.package.Dao.UserDaoImp">
    <beans:property name="dataSource" ref="dataSource"></beans:property>
</beans:bean>
<beans:bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
    <beans:property name="driverClassName" value="com.mysql.jdbc.Driver"></beans:property>
    <beans:property name="url" value="jdbc:mysql://localhost:3306/myschema"></beans:property>
    <beans:property name="username" value="myusername"></beans:property>
    <beans:property name="password" value="mypassword"></beans:property>
</beans:bean>
<beans:bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
    <beans:property name="dataSource" ref="dataSource"></beans:property>
</beans:bean>

   <context:component-scan base-package="my.package" />

<beans:bean class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">

    <beans:property name="mappings">
    <beans:value>inicio.do=flowController</beans:value>
    </beans:property>
    <beans:property name="alwaysUseFullPath" value="true"></beans:property>
</beans:bean>
<beans:bean id="flowcontroller" class="org.springframework.webflow.mvc.servlet.FlowController">
<beans:property name="flowExecutor" ref="flowExecutor"></beans:property>
</beans:bean>

当我尝试添加任何webflow标记时,例如:

<webflow:flow-executor id="flowExecutor" flow-registry="flowRegistry"/>

显示错误:

Multiple annotations found at this line:
- The prefix "webflow" for element "webflow:flow-executor" is not 
 bound.

似乎他找不到任何与webflow相关的标签,尽管我在schemaLocation中有它。

有任何帮助吗?谢谢。

编辑:我正在使用Spring的3.1.1-RELEASE版本,如pom.xml所示:

<org.springframework-version>3.1.1.RELEASE</org.springframework-version>

1 个答案:

答案 0 :(得分:3)

包含webflow命名空间,如下所示:

    <beans:beans xmlns="http://www.springframework.org/schema/mvc"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:beans="http://www.springframework.org/schema/beans"
    xmlns:mvc="http://www.springframework.org/schema/mvc" 
    xmlns:context="http://www.springframework.org/schema/context"
    xmlns:webflow="http://www.springframework.org/schema/webflow-config"
    xsi:schemaLocation="http://www.springframework.org/schema/beans 
                        http://www.springframework.org/schema/beans/spring-beans.xsd
                        http://www.springframework.org/schema/context 
                        http://www.springframework.org/schema/context/spring-context.xsd
                        http://www.springframework.org/schema/mvc
                        http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd
                         http://www.springframework.org/schema/webflow-config
        http://www.springframework.org/schema/webflow-config/spring-webflow-config-2.3.xsd">