Announcement Announcement Module
Collapse
No announcement yet.
what am i doing wrong? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • what am i doing wrong?

    I can't figure out why I'm getting this exception. I'm trying to write a very simple sample application with 2 pages; the first is a form and the second displays the results of the first.

    I'd be grateful if someone could look at this and tell me what I'm doing wrong. I can't even get the first page to display.

    Thanks.
    org.springframework.web.flow.ActionExecutionExcept ion: Exception thrown executing action 'waitlist.view.AdminSignInViewSetup@4d8d50' in state 'adminSignInViewSetup' of flow 'adminSignInFlow'; nested exception is org.springframework.util.DispatchMethodInvoker$Met hodLookupException: Unable to resolve action method with name 'adminSignInViewSetup' and signature 'public org.springframework.web.flow.Event adminSignInViewSetup(interface org.springframework.web.flow.RequestContext);'; make sure the method name is correct and such a public method is defined on targetClass waitlist.view.AdminSignInViewSetup; nested exception is java.lang.NoSuchMethodException: waitlist.view.AdminSignInViewSetup.adminSignInView Setup(org.springframework.web.flow.RequestContext)
    This is the class it's complaining about:
    Code:
    package waitlist.view;
    
    import org.springframework.web.flow.action.FormAction;
    import org.springframework.web.flow.ScopeType;
    
    public class
    AdminSignInViewSetup extends FormAction {
        public
        AdminSignInViewSetup() {
            setFormObjectClass(AdminSignIn.class);
            setFormObjectScope(ScopeType.FLOW);
        }
    }
    Here's waitlist-flow.xml:
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    
    <!DOCTYPE webflow PUBLIC
        "-//SPRING//DTD WEBFLOW//EN"
        "http&#58;//www.springframework.org/dtd/spring-webflow.dtd">
    
    <webflow id="adminSignInFlow" start-state="adminSignInViewSetup">
        <action-state id="adminSignInViewSetup">
            <action bean="adminSignInViewSetup" />
            <transition on="success" to="adminSignInView" />
        </action-state>
    
        <view-state id="adminSignInView" view="adminSignInView">
            <transition on="submit" to="bindAndValidate" />
        </view-state>
    
        <action-state id="bindAndValidate">
            <action bean="adminSignInViewSetup" method="bindAndValidate" />
            <transition on="success" to="debugView" />
        </action-state>
    
        <view-state id="debugView" view="debugView">
            <transition on="end" to="end" />
        </view-state>
    
        <end-state id="end" />
    </webflow>
    And here's waitlist-servlet.xml:
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    
    <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
            "http&#58;//www.springframework.org/dtd/spring-beans.dtd">
    
    <beans>
        <bean id="adminSignInViewSetup"
            class="waitlist.view.AdminSignInViewSetup">
            <property name="validator">
                <bean class="waitlist.view.AdminSignInValidator" />
            </property>
    
            <property name="formObjectName" value="adminSignIn" />
        </bean>
    
        <bean id="adminSignInValidator"
            class="waitlist.view.AdminSignInValidator" />
    
        <bean id="adminSignIn"
            class="waitlist.view.AdminSignIn" />
    
        <bean name="/index.cgi"
            class="org.springframework.web.flow.mvc.FlowController">
            <property name="synchronizeOnSession" value="true" />
            <property name="flow" ref="adminSignInFlow" />
        </bean>
    
        <bean id="adminSignInFlow"
            class="org.springframework.web.flow.config.XmlFlowFactoryBean">
            <property name="location" value="/WEB-INF/waitlist-flow.xml" />
        </bean>
    
        <!-- This one is always last when using the order property. -->
        <bean id="internalResourceViewResolver"
            class="org.springframework.web.servlet.view.InternalResourceViewResolver">
            <property name="viewClass"
                value="org.springframework.web.servlet.view.JstlView" />
            <property name="prefix" value="/WEB-INF/jsp/" />
            <property name="suffix" value=".jsp" />
        </bean>
    </beans>

  • #2
    In your FormAction there is not a corresponding method with the following signature:
    public Event adminSignInViewSetup (RequestContext context)
    However, I take it your initial state is just to setup the form for display. In that case, just do the following in your flow (rename the id to "setupForm").

    <action-state id="setupForm">
    <action bean="adminSignInViewSetup" />
    <transition on="success" to="adminSignInView" />
    </action-state>

    Comment


    • #3
      Ah, ok; many thanks!

      So the id of action-state isn't some name that I choose of my liking? Is this a special case when the first step of the flow is an action-state?

      Comment


      • #4
        Don't quote me on this since I am new to Spring Web Flow myself, but
        I believe since your action bean was a FormAction it was a shortcut mechanism.

        See the following link for more information:
        http://static.springframework.org/sp.../docs/pr3/api/

        _CJ

        Comment


        • #5
          Sorry, the link didn't quite work, but check-out the FormAction class in the API

          _CJ

          Comment


          • #6
            You can id your states whatever you want as long as each state's id is unique in the context of its owning flow definition.

            Now, with that said, if your state is an action state invoking a multi-action like a FormAction, BY DEFAULT the *id* of the state is treated as the *name* of the action method to execute. To specify the action method explicitly, just use the 'method' attribute of the action element.

            Comment


            • #7
              Yes they should. Thanks!

              Comment


              • #8
                Great, thanks.
                Code:
                <webflow id="adminSignInFlow" start-state="adminSignInViewSetup">
                    <action-state id="adminSignInViewSetup">
                        <action bean="adminSignInViewSetup" method="setupForm" />
                        <transition on="success" to="adminSignInView" />
                    </action-state>
                    ...

                Comment

                Working...
                X