Spring Form Controller with DWR

1.5k views Asked by At

I am using spring and DWR combination,When i do ajax request from DWR.I want to access entire form values bind to the bean in my DAO layer.

I didn't find any examples for Spring form controller with DWR.

Any suggestions or help appreciated.

Thanks in Advance.

Regards,

Raj

1

There are 1 answers

4
mdrg On BEST ANSWER

Considering your problem is how to create Spring-DWR integration, so that you can simulate Spring controller calls from Java, try it like this:

Your Spring XML config:

<bean id="myController" class="pkg.MyController">

    <property name="service1" ref="service1Bean"/>
    <property name="service2" ref="service2Bean"/>

    <dwr:remote javascript="MyControllerInJavascript">
        <dwr:include method="method1"/>
        <dwr:include method="method2"/>
    </dwr:remote>

</bean>

Your controller:

package pkg;

public class MyController {

    public SomeObject method1(String argument1, Long argument2) {
        ...
    }

    public OtherObject method2(YetAnotherObject argument1) {
        ...
    }

}

In your Javascript:

<script type="text/javascript"
        src="/your_dwr_path/interface/MyControllerInJavascript.js"/>

MyControllerInJavacript.method1('argument',123,callbackMethod);

Further integration steps you can find at the docs.