Announcement Announcement Module
Collapse
No announcement yet.
Not able to access form-bean in the Action class Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Not able to access form-bean in the Action class

    Hi,
    I am working on a SWF based wizard application.
    I hv defined following entry in my application servlet xml:

    <bean id="formAction" class="org.springframework.webflow.action.FormActi on">
    <property name="formObjectName" value="inputCriteria"/>
    <property name="formObjectClass" value="data.FormBeanObject"/>
    <property name="formObjectScope" value="FLOW"/>
    <property name="validator">
    <bean class="domain.InputCriteriaValidator"/>
    </property>
    </bean>

    I hv defined the services.xml as follows:

    <beans>
    <bean id="CreateService" class="domain.StubCreateService"/>
    <bean id="queryAction" class="domain.QueryAction"/>
    </beans>

    I hv the following entry in my flow xml:

    <action-state id="getForm2Details">
    <action bean="queryAction"/>
    <transition on="success" to="mbcSecond"/>
    </action-state>

    When i click on Next to navigate to page 2 of the wizard, the above flow is invoked. This causes the framework to invoke the method: public Event execute(RequestContext reqCtxt) in the class: domain.QueryAction

    I hv a small piece of code in this method where i try to access the Form Bean object.
    But i am getting it as 'null'.

    HttpServletRequest request = ((ServletExternalContext)reqCtxt.getExternalContex t()).getRequest();
    FormBeanObject formObj = (FormBeanObject) request.getAttribute("inputCriteria");
    logger.debug("-----formObj---"+formObj);

    Could anybody point any mistake here? Or is the formbean not accessible from the Action class? If yes, how do i access it?

    Regards
    arvind.

  • #2
    You have to call 'setupForm' on your FormAction before invoking a method that queries for your form object by name.

    Keith

    Comment


    • #3
      My flow xml is as follows:
      <flow start-state="firstPage">

      <view-state id="firstPage" view="DEMOcreateBondingDgmFirst">
      <entry-actions>
      <action bean="formAction" method="setupForm"/>
      </entry-actions>
      <transition on="submit" to="getForm2Details">
      <action bean="formAction" method="bind"/>
      </transition>
      </view-state>

      <action-state id="getForm2Details">
      <action bean="queryAction" method="setupForm"/>
      <transition on="success" to="mbcSecond"/>
      </action-state>

      I mentioned the method 'setupForm' on the entry of the action-state as well.
      IT still does not work!?

      Comment

      Working...
      X