The 'new' Creator

The new creator is declared by default by DWR as follows: <creator id="new" class="org.directwebremoting.create.NewCreator"/> You don't need to add this line to your dwr.xml because it is already in DWR's internal dwr.xml file.

This creator will create an instance of a class using the default constructor. There are several benefits to using the 'new' creator:

You allow DWR to use the new creator to create and remote your beans as follows:

<allow>
  <create creator="new" javascript="Blah">
    <param name="class" value="java.util.Date"/>
  </create>
  ... 
</allow>

This remotes java.util.Date to Javascript and gives it the name Blah so in Javascript when you call Blah.toString(reply) a new java.util.Date will be constructed using the default constructor. Then the toString() method will be called, and the data returned to the javascript reply function (in this case the current date in string form).

Please note that the creator, and javascript attributes are required as well as the param element which indicates which class DWR should create.