0

我正在尝试进行 webflow 项目,但我不断收到以下错误,它找不到我的控制器?

这是我的流程代码:

<flow xmlns="http://www.springframework.org/schema/webflow"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springframework.org/schema/webflow
                          http://www.springframework.org/schema/webflow/spring-webflow-2.0.xsd">

    <var name="member" class="org.uftwf.enrollment.domain.Member" />

    <decision-state id="checkIsInPending">
        <if test="FlowActions.isInPending()" then="endStateMemeberPending" else="name" />
    </decision-state>

    <view-state id="name" view="enrollment1.jsp">
        <transition on="submit" to="SSNonFile" />
        <transition on="cancel" to="endState" bind="false" />
    </view-state>

    <action-state id="SSNOnFile">
     <evaluate expression="FlowActions.isSSNOnFile(member)" />
         <transition on="SUCCESS" to="endStateNoSSN" />
        <transition on="FAIL" to="isMemeber" />
    </action-state>

    <action-state id="isMemeber">
     <evaluate expression="FlowActions.isMemeber(member)" />
         <transition on="SUCCESS" to="endStateMemeberExists" />
        <transition on="FAIL" to="isDeceased" />
    </action-state>

    <action-state id="isDeceased">
     <evaluate expression="FlowActions.isDeceased(member)" />
         <transition on="SUCCESS" to="endStateMemeberExists" />
        <transition on="FAIL" to="address" />
    </action-state>

    <view-state id="address" view="enrollment2.jsp">
        <transition on="submit" to="endStateSuccess" />
        <transition on="cancel" to="name" bind="false" />
    </view-state>


    <view-state id="preview" model="customer">
        <transition on="cancel" to="name" />
        <transition on="accept" to="endStateSuccess">
            <evaluate expression="FlowActions.addCustomer(member)" />
        </transition>
    </view-state>

    <!-- End state -->
    <end-state id="endStateMemberDeceased" view="unsuccessful.jsp" />
    <end-state id="endStateNoSSN" view="noSSN.jsp" />
    <end-state id="endStateMemeberExists" view="exists.jsp" />
    <end-state id="endStateMemeberPending" view="pending.jsp" />
    <end-state id="endStateSuccess" view="success.jsp" />



</flow>

这是我的控制器代码:

package org.uftwf.enrollment.controller.swf;
import static org.apache.log4j.Logger.getLogger;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.uftwf.enrollment.domain.Member;
import org.uftwf.enrollment.service.TestService;

@Component
public class FlowActions {

    @Autowired
    private TestService testService;

    private static final Logger LOGGER = getLogger(FlowActions.class);

    public void addCustomer(Member customer) {
    //  testService.saveCustomer(customer);
    }

    public boolean isInPending()
    {
        LOGGER.debug("in side isInPending()");
        return false;
    }

    public void isSSNOnFile(Member customer)
    {

    }

    public void isMemeber(Member customer)
    {

    }

    public void isDeceased(Member customer)
    {

    }





}

疯狂的错误。我的项目找不到带有 webflow 的控制器 ..

SEVERE: Servlet.service() for servlet [spring] in context with path [/enrollment] threw exception [Request processing failed; nested exception is org.springframework.webflow.execution.FlowExecutionException: Exception thrown in state 'checkIsInPending' of flow 'enroll'] with root cause
org.springframework.expression.spel.SpelEvaluationException: EL1008E:(pos 0): Field or property 'FlowActions' cannot be found on object of type 'org.springframework.webflow.engine.impl.RequestControlContextImpl'

这是我的 root-config.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: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-3.1.xsd">

    <import resource="mvc.xml" />
    <import resource="flow.xml" />
    <import resource="domain.xml" />


    <context:component-scan base-package="org.uftwf.enrollment.controller" />



</beans>
4

1 回答 1

1

您应该引用 bean flowActions,而不是类FlowActions。尝试更改初始“f”的大小写。

例如

<if test="flowActions.isInPending()" then="endStateMemeberPending" else="name" />

于 2012-08-17T23:17:45.367 回答