atitit.ajax bp dwr 3.的注解方式配置使用流程总结.....
atitit.ajax?bp?dwr?3.的注解方式配置使用流程總結.....
?
1.?下載??dwr.jar?1M 1
2.?配置注解方式..web.xml 1
3.?Class?配置 2
4.?測試查看公布的方法 2
5.?導入到page頁面 3
6.?使用在js黑頭 3
7.?#=====param?sh?requesst 3
8.?Xxx?is?undefine 4
9.?Warning:?overloaded?methods?are?not?recommended 4
?
1.?下載??dwr.jar?1M
Development?Release:?Version?3?release?candidate?2?(3.0?RC2)
2.?配置注解方式..web.xml
<!--?o71?-->
<servlet>
??<display-name>DWR?Servlet</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")?
public?class?AwdSvs_shake_Perdaymode?
//???下午5:31:28?2014-7-2??老哇的爪子??Attilax
@RemoteMethod?public?String?leftNum_noReq(String?uid,?String?actid)?{
?
?
4.?測試查看公布的方法
http://192.168.1.63/weixin/dwr/index.html
Modules?known?to?DWR:
·?AwdSvs_shake_PerdaymodeProx(NewCreator?for?com.focustar.service.AwdSvs_shake_Perdaymode)
?
點擊類k能看到方法一瓦...能單個的方法測試了...stub已經ok蘭...
查看詳細調用參數,能不個js下載哈來..不個http://192.168.1.63/weixin/dwr/interface/AwdSvs_shake_PerdaymodeProx.js下載哈來..
?
?
5.?導入到page頁面
Source?code?查看...
復制..
?<script?type='text/javascript'?src='/weixin/dwr/engine.js'></script>
??<script?type='text/javascript'?src='/weixin/dwr/interface/AwdSvs_shake_PerdaymodeProx.js'></script>
?
?
?
??<script?type='text/javascript'?src='/weixin/dwr/util.js'></script>
?
?
6.?使用在js黑頭
?AwdSvs_shake_PerdaymodeProx.startDraw_noreq(?openid,actid,???function(data)
?????????{
//alert(data);
//var?data_json=eval(data);
var?data_json?=?eval("("?+?data?+?")");
?????????//?????alert(data_json.code);
????????????drawAftEvent(data_json);
?????????}
);
?
7.?#=====param?sh?requesst
?
不個http://192.168.1.63/weixin/dwr/interface/AwdSvs_shake_PerdaymodeProx.js下載哈來..
????/**
?????*?@param?{function|Object}?callback?callback?function?or?options?object
?????*/
????p.leftNums?=?function(callback)?{
??????return?dwr.engine._execute(p._path,?'AwdSvs_shake_PerdaymodeProx',?'leftNums',?arguments);
};
?
?
直接傳callback走ok蘭...
子能不個哪rewrite蘭,不個參數直接傳類k...
?
8.?Xxx?is?undefine
Thourng?yeu?trace?l?,走十不曉得為什么trace?不的上去....大概太深的蘭吧...
?
原來的是js能直接顯示拉李undefine...
?
只好ff黑頭step?調試..還湊火,能調試了.林吧...
?
?
9.?Warning:?overloaded?methods?are?not?recommended
Javascript?does?not?support?overloaded?methods,?so?the?javascript?file?generated?from?this?class?will?contain?two?methods?the?second?of?which?will?replace?the?first.?This?is?probably?not?what?you?wanted.
It?is?best?to?avoid?overloaded?methods?when?using?DWR.
3.
《新程序員》:云原生和全面數字化實踐50位技術專家共同創作,文字、視頻、音頻交互閱讀總結
以上是生活随笔為你收集整理的atitit.ajax bp dwr 3.的注解方式配置使用流程总结.....的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 元字符
- 下一篇: AngularJS 拦截器和好棒例子