How to Reverse Ajax in DWR
AJAX elements added to a Web page are designed to query a server when the page loads. Direct Web Remoting, sometimes referred to as DWR, lets users reverse this system so that a server can transmit information to a Web page via an AJAX element, which is otherwise difficult to achieve. This feature is useful for anyone who needs to continually upload a Web page with data that is aggregated from multiple sources and sent to a single server.
Instructions
-
-
1
Open your website's "web.xml" file by right-clicking on the file and choosing "Open With," then clicking "Notepad." The file will automatically open in the program.
-
2
Add the following code to the end of the file:
<servlet>
<servlet-name>dwr-invoker</servlet-name>
<servlet-class>org.directwebremoting.servlet.DwrServlet</servlet-class>
<init-param>
<param-name>activeReverseAjaxEnabled</param-name>
<param-value>true</param-value>
</init-param>
</servlet> -
-
3
Click "File," then "Save" to save the changes you made to the file, then close Notepad.
-
4
Open the Web page that has the AJAX element you want to reverse in Notepad. Add the following line of code to the end of the AJAX script:
dwr.engine.setActiveReverseAjax(true);
-
5
Click "File," then "Save" to save the changes, then close Notepad.
-
1