Spring Form Controller with DWR

Deadly 提交于 2020-02-02 06:19:34

问题


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:


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.



来源:https://stackoverflow.com/questions/4968162/spring-form-controller-with-dwr

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!