Intergrate DWR into Your Java Web Application - Configuring the Application
(Page 2 of 4 )
To get DWR going with your JavaScript, you have to declare in web.xml a Java servlet that DWR uses. Here is the chunk of code that you have to add to web.xml. If web.xml already includes registered servlets, nest this newly declared servlet in with the existing ones (the same goes for the servlet-mappingelement):
<servlet>
<servlet-name>dwr-invoker</servlet-name>
<servlet-class>uk.ltd.getahead.dwr.DWRServlet</servlet-class>
<init-param>
<param-name>debug</param-name>
<param-value>true</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>dwr-invoker</servlet-name>
<url-pattern>/dwr/*</url-pattern>
</servlet-mapping>
Next: Direct Web Remoting (DWR) for Java Jocks >>
More JavaScript Articles
More By O'Reilly Media
|
This article is excerpted from Hack 42 of the book Ajax Hacks, written by Bruce W. Perry (O'Reilly; ISBN: 0596101694). Check it out today at your favorite bookstore. Buy this book now.
|
|