开发者

How does Direct Web Remoting (DWR) work?

开发者 https://www.devze.com 2023-03-07 19:08 出处:网络
How exactly or what exactly does Direct Web开发者_运维百科 Remoting (DWR) do? While I have already gone through the official site http://directwebremoting.org/

How exactly or what exactly does Direct Web开发者_运维百科 Remoting (DWR) do? While I have already gone through the official site http://directwebremoting.org/ I wanted to understand in simple language..

Specifically I have following questions; 1. While engine.js is standard Javascript library, how exactly does it help in including that in our app ? 2. What is so special about DWR that cannot be done by normal Javascript / AJAx combination?

Thank you.


OK, I've only had a brief look at DWR and I was wondering the same thing. As far as I can gather DWR builds and includes on your page some javascript that mirrors your server-side java. It will generate client-side proxies that you can call in your javascript. So instead of using jquerys $.ajax(...) command and specifying the url, data type, data, etc, you can just use RemoveObj.doSomeStuff(...) and it'll do the actual AJAX request for you, behind the scenes.

This is basically what ASP.NET does too when you declare a [WebMethod]. Its simply a shortcut and might save time with maintenance, e.g. if your urls change I suspect DWR will update its client-side code too.

My only issue with this is that it seems to pollute the namespace.

To actually answer your question it does nothing you can't do with normal javascript and servlets.

0

精彩评论

暂无评论...
验证码 换一张
取 消