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

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

    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"/>

    I hv defined the services.xml as follows:

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

    I hv the following entry in my flow xml:

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

    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");

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


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



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

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

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

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