简体   繁体   中英

How does Direct Web Remoting (DWR) work?

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, eg 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM