Announcement Announcement Module
Collapse
No announcement yet.
Not able to bind - I'm missing something. Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Not able to bind - I'm missing something.

    My scenario:

    1. defined token bean
    ------------------------
    <bean id="formAction" class="org.springframework.webflow.action.FormActi on">
    <property name="formObjectName"
    value="token"/>
    <property name="formObjectClass"
    value="testpackage.Token"/>
    <property name="formObjectScope"
    value="FLOW"/>
    <property name="validator">
    <bean class="testpackage.TokenValidator"/>
    </property>
    </bean>

    2. defined flow as
    ------------------
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE flow PUBLIC "-//SPRING//DTD WEBFLOW 1.0//EN"
    "http://www.springframework.org/dtd/spring-webflow-1.0.dtd">

    <flow start-state="doTokenFlow">

    <view-state id="doTokenFlow" view="jsp/tokenDetail">
    <entry-actions>
    <action bean="tokenManager" method="getNextToken"/>
    </entry-actions>
    <transition on="submit" to="tokenAction">
    <action bean="formAction" method="bindAndValidate"/>
    </transition>
    </view-state>

    <action-state id="tokenAction">
    <action bean="tokenManager" method="getNextToken"/>

    <transition on="success" to="nextToken"/>
    <transition on="error" to="doSomethingElse"/>
    <transition on="finish" to="doSomethingElse"/>
    </action-state>

    <view-state id="nextToken" view="jsp/tokenDetail">
    <transition on="submit" to="tokenAction">
    <action bean="formAction" method="bindAndValidate"/>
    </transition>
    </view-state>

    <end-state id="doSomethingElse" view="user/screen0"/>
    <end-state id="cancel"/>

    <import resource="token-flow-context.xml"/>
    </flow>


    3. TokenManager puts one token in the request context for use in jsp
    -----------------------------------------------------
    public Event getNextToken(RequestContext context)
    {
    if (currentTokenIndex > 0)
    {
    this.tokens[currentTokenIndex] =
    (Token) context.getFlowScope().get("token");
    // trying to retrieve current token and set it back to array - however, its doesnt exist in scope
    }
    if (currentTokenIndex < tokens.length)
    {
    context.getFlowScope().put("token", this.tokens[currentTokenIndex++]);
    return success();
    } else
    {
    return error();
    }

    }

    continued in next message...

  • #2
    Unable to post remainder of message, keep getting:
    You have included 6 images in your message - I have no images in it

    Comment


    • #3
      Can you use the code or html tags? It's hard to read otherwise. Thanks,
      Last edited by Keith Donald; Jul 8th, 2006, 11:49 AM.

      Comment


      • #4
        4. jsp tries to display values from token and add a property value - valueTen
        -----------------------------------------------------------------------------
        <fieldset>
        <tr>
        <td>
        <c:out value="${token.valueOne}"/>
        </td>
        </tr>
        <tr>
        <td>
        <c:out value="${token.operation}"/>
        <c:out value="${token.valueTwo}"/>
        </td>
        </tr>

        <tr>
        <spring:bind path="token.valueTen">
        <td>
        <label>
        <input type="text" name="<c:out value="${status.expression}"/>" value="<c:out value="${status.value}"/>"/>
        </label>
        </td>
        </spring:bind>
        </fieldset>

        5. getting error on jsp
        "Neither Errors instance nor plain target object for bean name 'token' available as request attribute"

        6. however on the jsp
        <c:out value="${token.operation}"
        shows the proper value - note "${token.operation}" value is visible

        7. also, bindAndValidate doesnt get called

        Please enlighten me. I've perused examples and tried to work this out myself.

        Comment


        • #5
          Looks to me like you're never calling 'setupForm' on your form action before your form view displays. It's kind of hard to tell without formatting.

          Keith

          Comment

          Working...
          X