Question

I want to add webflow to a web. I have the webflow dependency in the pom.xml, I have started to add beans, but seems unable to find any tag, as I see in every tutorial. I have all my beans in servlet-context.xml, and this is it:

<?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>

When I try to add any webflow tag, for example:

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

It show an error:

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

Seems that he can't find any webflow-related tag, despite I have it in the schemaLocation.

Any help? Thank you.

EDIT: Im using 3.1.1-RELEASE version of Spring, as seen on the pom.xml:

<org.springframework-version>3.1.1.RELEASE</org.springframework-version>
Was it helpful?

Solution

Include webflow namespace as shown below:

    <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">
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top