util.js

util.js contains a number of utility functions to help you update your web pages with javascript data (such as might be returned from the server). DWR's focus is not on DOM based utilities, thus these utilities are limited in scope. There are several other libraries (JS templating tools, jQuery, etc.) that are more robust in this area that you may want to explore if util.js does not meet your needs.

You can use util.js outside of DWR because (with the exception of useLoadingMessage()) it does not depend on the rest of DWR to function. You can download a DWR Util with the DWR war file and then extract it from /dwr/dwr/util.js.

All engine.js functions have the dwr.util prefix.

The 4 basic page manipulation functions: getValue[s]() and setValue[s]() work on most HTML elements except tables, lists and images. getText() works with select lists.

Out of the box several of the functions in util.js (addRows, setValue(s), getValue(s)) escape dangerous characters to protect your application from XSS.

To edit tables see addRows() and removeAllRows(). To edit lists (both select lists and ul, ol lists) see addOptions() and removeAllOptions().

The complete list of utilities looks like this: