Results 1 to 3 of 3

Thread: i need a CommandController combined with FormController

  1. #1
    Join Date
    Nov 2005
    Location
    Ede
    Posts
    14

    Question 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. #2
    Join Date
    Nov 2005
    Location
    Ede
    Posts
    14

    Default

    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.

  3. #3
    Join Date
    Jul 2005
    Posts
    246

    Default

    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

Posting Permissions

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