Configuration
DWR is configured using XML files, annotations, or Fluent Interface style. Using XML files is the most typical method for DWR configuration, and there are two files: web.xml
and dwr.xml
. The first one, web.xml
, is a must for other configuration methods also. Annotations and fluent-style configurations may be used in place of dwr.xml
. This section describes the configuration methods and how to use them.
web.xml
Configuration starts by defining the DWR servlet in the web application's web.xml
configuration file. This is, of course, mandatory since DWR would not work without it. A minimum configuration does not have any init
parameters, and is shown as follows:
<servlet> <servlet-name>dwrservlet</servlet-name> <servlet-class>org.directwebremoting.servlet.DwrServlet</servlet- class> </servlet> <servlet-mapping> <servlet-name>dwrservlet</servlet-name> <url-pattern>/dwrservlet/*</url-pattern> </servlet-mapping>...