Results 1 to 8 of 8

Thread: what am i doing wrong?

  1. #1
    Join Date
    May 2005
    Location
    California, US
    Posts
    735

    Default 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. #2
    Join Date
    Dec 2004
    Location
    CA
    Posts
    208

    Default

    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>

  3. #3
    Join Date
    May 2005
    Location
    California, US
    Posts
    735

    Default

    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?

  4. #4
    Join Date
    Dec 2004
    Location
    CA
    Posts
    208

    Default

    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

  5. #5
    Join Date
    Dec 2004
    Location
    CA
    Posts
    208

    Default

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

    _CJ

  6. #6
    Join Date
    Aug 2004
    Location
    Melbourne, FL
    Posts
    2,794

    Default

    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.
    Keith Donald
    Core Spring Development Team

  7. #7
    Join Date
    Aug 2004
    Location
    Melbourne, FL
    Posts
    2,794

    Default

    Yes they should. Thanks!
    Keith Donald
    Core Spring Development Team

  8. #8
    Join Date
    May 2005
    Location
    California, US
    Posts
    735

    Default

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

Similar Threads

  1. Replies: 0
    Last Post: Sep 5th, 2005, 09:40 AM
  2. Transaction rolling back - What's wrong ??
    By vaibhavkhattri in forum Data
    Replies: 5
    Last Post: Aug 16th, 2005, 04:42 AM
  3. Replies: 6
    Last Post: Dec 3rd, 2004, 04:15 AM
  4. Replies: 2
    Last Post: Sep 23rd, 2004, 11:03 AM
  5. Step-by-step tutorial - wrong output
    By jconsult in forum Web
    Replies: 7
    Last Post: Sep 12th, 2004, 03:45 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •