带DWR的弹簧形式控制器 [英] Spring Form Controller with DWR

查看:94
本文介绍了带DWR的弹簧形式控制器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用spring和DWR组合,当我从DWR执行ajax请求时。我想访问整个表单值绑定到我的DAO层中的bean。

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.

我没有找到任何带有DWR的Spring表单控制器的示例。

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

任何建议或帮助表示赞赏。

Any suggestions or help appreciated.

提前致谢。

问候,

Raj

推荐答案

考虑到你的问题是如何创建Spring-DWR集成,以便你可以用Java模拟Spring控制器调用,试试这样:

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

你的Spring XML配置:

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>

您的控制人:

package pkg;

public class MyController {

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

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

}

在您的Javascript中:

In your Javascript:

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

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

您可以在文档

这篇关于带DWR的弹簧形式控制器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆