RIFE : Ajax
This page last changed on Apr 17, 2006 by gbevin.
The DWR team has worked hard to make their project as modular as possible and to abstract it away as much as possible from the Servlet API. While their effort is still in progress and there hasn't been an official DWR release with these features yet, we already integrated a DWR snapshot with RIFE to provide easy Ajax capabilities will all the power of RIFE's element components. To make this work you have to use the DWR jar file that's shipped with the rife-sumo distribution archive.
RIFE ships with a new standard element declaration that can be accessed through the file "rife/ajax/dwr.xml".
<element id="DwrService" file="rife/ajax/dwr.xml" url="dwr/*"/>
That element will by default look for "dwr.xml" in the classpath. This is a standard DWR configuration file and you can find the details about it in their documentation.
However, you can also specify a specific DWR configuration file for each Ajax element through the xmlConfiguratorPath property.
<element id="DwrDate" file="rife/ajax/dwr.xml" url="dwr/jdate/*"> <property name="xmlConfiguratorPath">jdate.xml</property> <property name="debug">true</property> </element>
Notice the debug property which, when set to true, allows you to access the root URL of the element ("dwr/jdate/" in this case) and get a nifty DWR test page. It's recommended to turn this on during development.
Let's look at the content of this example's "jdate.xml" file:
Your element will now expose the methods of the java.util.Date class through Ajax.
<!--V 'ELEMENT:DwrDate'--> names = JDate includeUtil = true <!--/V-->
|Document generated by Confluence on Oct 19, 2010 14:56|