2012-08-15 74 views
0

我想工作一個webflow項目,但我不斷收到以下錯誤,它不能找到我的控制器?webflow2沒有找到我的java代碼(控制器)

這裏是我的流量代碼:

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

這裏是我的根-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> 
+0

你可以發佈你的webflow配置和你的應用程序上下文嗎? – rptmat57 2012-08-15 20:39:04

+0

你可以發佈你的flow.xml嗎? – rptmat57 2012-08-16 15:03:07

回答

1

你應該引用豆flowActions,不是類FlowActions。嘗試改變最初的'f'的情況。

E.g.

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