DWR is short for Direct Web remoting.
DWR (Direct Web remoting) is a web Remote Call framework that makes Ajax development very simple.
DWR is an open-source solution using the Apache license protocol. It contains the server-side Java library, a DWR servlet, and a javascript library. Although DWR is not the only available Ajax-RPC toolkit on the Java platform, it is the most mature and provides many useful functions.
From the simplest point of view, DWR is an engine that can expose methods of server-side Java objects to JavaScript.Code. Using DWR can effectivelyProgramEliminate all Ajax request-response loops in the code. This means that the client Code no longer needs to directly process the XMLHTTPRequest object or server response. You no longer need to compile Object serialization code or use a third-party tool to convert an object into XML. You do not even need to write servlet code to adjust Ajax requests to call Java domain objects.
DWR is deployed as a servlet in a web application. Think of it as a black box. This servlet has two main functions: first, for each public class, DWR dynamically generates JavaScript contained in the web page. The generated JavaScript contains the stub function, representing the corresponding methods in the Java class and executing XMLHttpRequest behind the scenes. These requests are sent to DWR. At this time, its second role is to translate the requests into method calls on the server-side Java object and put the return values of the methods in the servlet response and send them back to the client, encode it into JavaScript. DWR also provides JavaScript tool functions to help you execute common user interface tasks.