atitit.ajaxbpdwr3.的注解方式配置使用流程总结.....
9.Warning:overloadedmethodsarenotrecommended 4
1.下载dwr.jar1M
DevelopmentRelease:Version3releasecandidate2(3.0RC2)
2.配置注解方式..web.xml
<!--o71-->
<servlet>
<display-name>DWRServlet</display-name>
<servlet-name>dwr-invoker</servlet-name>
<servlet-class>org.directwebremoting.servlet.DwrServlet</servlet-class>
<init-param>
<param-name>debug</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
<param-name>allowImpossibleTests</param-name>
<param-value>true</param-value>
</init-param>
<!--将设定注解的域对象和业务实现类放在下面列表中,中间使用逗号间隔-->
<init-param>
<param-name>classes</param-name>
<param-value>
com.focustar.service.AwdSvs_shake_Perdaymode
</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>dwr-invoker</servlet-name>
<url-pattern>/dwr/*</url-pattern>
</servlet-mapping>
作者::老哇的爪子Attilax艾龙,EMAIL:1466519819@qq.com
转载请注明来源:http://blog.csdn.net/attilax
3.Class配置
@RemoteProxy(name="AwdSvs_shake_PerdaymodeProx")
publicclassAwdSvs_shake_Perdaymode
//下午5:31:282014-7-2老哇的爪子Attilax
@RemoteMethodpublicStringleftNum_noReq(Stringuid,Stringactid){
4.测试查看公布的方法
http://192.168.1.63/weixin/dwr/index.html
ModulesknowntoDWR:
·AwdSvs_shake_PerdaymodeProx(NewCreatorforcom.focustar.service.AwdSvs_shake_Perdaymode)
点击类k能看到方法一瓦...能单个的方法测试了...stub已经ok兰...
查看详细调用参数,能不个js下载哈来..不个http://192.168.1.63/weixin/dwr/interface/AwdSvs_shake_PerdaymodeProx.js下载哈来..
5.导入到page页面
Sourcecode查看...
复制..
<scripttype='text/javascript'src='/weixin/dwr/engine.js'></script>
<scripttype='text/javascript'src='/weixin/dwr/interface/AwdSvs_shake_PerdaymodeProx.js'></script>
<scripttype='text/javascript'src='/weixin/dwr/util.js'></script>
6.使用在js黑头
AwdSvs_shake_PerdaymodeProx.startDraw_noreq(openid,actid,function(data)
{
//alert(data);
//vardata_json=eval(data);
vardata_json=eval("("+data+")");
//alert(data_json.code);
drawAftEvent(data_json);
}
);
@L_301_16@7.#=====paramshrequesst
不个http://192.168.1.63/weixin/dwr/interface/AwdSvs_shake_PerdaymodeProx.js下载哈来..
/**
*@param{function|Object}callbackcallbackfunctionoroptionsobject
*/
p.leftNums=function(callback){
returndwr.engine._execute(p._path,'AwdSvs_shake_PerdaymodeProx','leftNums',arguments);
};
直接传callback走ok兰...
子能不个哪rewrite兰,不个参数直接传类k...
8.Xxxisundefine
Thourngyeutracel,走十不晓得为什么trace不的上去....大概太深的兰吧...
原来的是js能直接显示拉李undefine...
只好ff黑头step调试..还凑火,能调试了.林吧...
9.Warning:overloadedmethodsarenotrecommended
Javascriptdoesnotsupportoverloadedmethods,sothejavascriptfilegeneratedfromthisclasswillcontaintwomethodsthesecondofwhichwillreplacethefirst.Thisisprobablynotwhatyouwanted.
ItisbesttoavoidoverloadedmethodswhenusingDWR.
3.