Spring form controller with DWR

I use spring and a combination of DWR when I make an ajax request from DWR. I want to access all the values ​​of the form bound to a bean in my DAO layer.

I have not found examples for spring form controller with DWR.

Any suggestions or help are appreciated.

Thanks at Advance.

Hi,

Rajah

+3
source share
1 answer

Given your problem, how to create Spring -DWR integration so that you can simulate Spring controller calls with Java, try to do it like this:

Spring XML configuration:

<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 can be found in the docs .

+2
source

Source: https://habr.com/ru/post/1791450/


All Articles