dwr整合Spring:
找到Spring配置文件的方法:
1.ContextLoaderListener,在web app的web.xml文件中指定配置文件位置
2.在dwr.xml文件中使用location参数:
<create creator="spring" javascript="xx">
<param name="beanName" value="com.xx" />
<param name="location" value="applicationContext.xml" />
</create>
DWR中engine.js的一些用法:
?错误处理:DWREngine.setErrorHandler(function) (设置全局错误处理方式);
?警告处理:DWREngine.setWarningHandler(function)(设置全局错误处理方式);
全局的DWREngine.setTimeout()函数设置全局超时。如果设置值为0(默认)可以将超时关掉。允许对单独的方法调用设置超时时间,如果发生调用超时,则错误处理就会被调用。如:
FirstDWR.sayHello(name,{
callback : function(data){alert(data);},
errorHandler : function(msg){alert("timeout!");},
timeout : 0.000000000000000001
});
?
DWREngine.setPreHook(function) 和 DWREngine.setPostHook(function) 分别用来在调用之前和调用之后要执行的动作。
DWREngine.setVerb("GET");用来设置选择GET还是POST。
DWR中util.js的一些用法:
操作Table的一般方法:addRows()? removeAllRows();
操作select的一般方法:addOptions() removeAllOptions;
在操作select时,如果想加入一个初选值:DWRUtil.addOptions(id, ["请选择。。。"]);
而DWRUtil.getValue(id) DWRUtil.setValue(id,value) 分别用来取得id元素的值? 给id元素设置值
?