Announcement Announcement Module
Collapse
No announcement yet.
i need a CommandController combined with FormController Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • i need a CommandController combined with FormController

    Hey all,

    I got a little problem here, I need a combination of a formcontroller with a commandcontroller. I want to show a dossier in a jsp page, with the option of adding comments to it at the bottom of the page. Therefor it needs to have command support to recieve information on which dossier to show, but also needs form support so i can implement the referenceData() and onSubmit() methods.

    Does anyone know whether this allready exists? Or do i have to create an AbstractCommandFormController myself?

    Help would be highly appreciated.

    Geert Schuring.
    Netherlands.

  • #2
    i allready found out that simpleFormController also has command support... but the problem now is that for showing the form a different command object should be used than for submitting the form... any ideas on how to solve this??
    I guess this is a pretty common occurring case, so i'd like to know how other ppl solve this...

    Geert.

    Comment


    • #3
      I've got my own AbstractViewController that has a property (associatedFormController) that can be injected by Spring with the form controller that will be called on submission of that page. I then have an AbstractFormController that exposes a createFormBackingObject method that the view controller can call to initialise it and store it in the request. All my form and view controllers then extend these abstract controllers.

      Thus my context XML can contain something like this:-

      Code:
      <bean id="deliveryAddressViewController" class="org.xxx.xxxx.controller.DeliveryAddressViewController">
          <property name="associatedFormController">
              <ref bean="deliveryAddressFormController"/>
          </property>
      </bean>
          
      <bean id="deliveryAddressFormController" class="org.xxx.xxxx.controller.DeliveryAddressFormController">
          <property name="commandName"><value>deliveryAddressCommand</value></property>
          <property name="commandClass"><value>org.xxx.xxxx.command.DeliveryAddressCommand</value></property>
          <property name="sessionForm"><value>true</value></property>
          <property name="formView"><value>secure/checkout/deliveryAddress</value></property>
          <property name="successView"><value>/secure/checkout/summary</value></property>
      </bean>
      Bob

      Comment

      Working...
      X