A Field Guide to Java Direct Web Remoting (DWR), Page 2
Recall that the DWR Servlet was mapped under the dwr pattern in the web.xml file.
Also, recall that in the dwr.xml file there is a definition to expose ItemManager class.
The general format for the dynamic address is:
In the <script> tag, this address is set as the src attribute's value. For example:
If you want to debug/test the DWR calls, the DWR Servlet needs to be in debug mode in the web.xml file. To enable debug, set the parameter for debug to true. Note that this is probably not desirable in production because it shows all available methods of the object to the client.
<init-param> <param-name>debug</param-name> <param-value>true</param-value> </init-param>
To see the test client point your browser to
This will show all exposed objects, and if you click on the object name, you will see available methods—both exposed and not exposed by the DWR.
Only exposed methods are callable directly on the test page.
Notice that the methods defined in the dwr.xml are active and some methods even take parameters.
Download the source code for the article here. The author would like to acknowledge and thank James Harmon for his contribution of the source code.
About the Author
Vlad Kofman is working on enterprise-scale projects for the major Wall Street firms. He has also worked on the defense contracts for the U.S. government. His main interests are object-oriented programming methodologies, UI, and design patterns.