title: How to update users list using DWR
body: <p>I am developing chat client which can connect to Gtalk and Facebook.I am using DWR for the purpose.</p>
  
  <p>Once I log into I have to populate the user s lists. On client side I have</p>
  
  <pre><code>function showUsersOnline() {
      var cellFuncs = [ function(user) {
  
          return '&lt;i&gt;'+user+'&lt;/i&gt;';
      } ];
      LoginG.usersOnline( {
          callback : function(users) {
              dwr.util.removeAllRows('usersOnline');
              dwr.util.addRows("usersOnline", users, cellFuncs, {
                  escapeHtml : false
              });
  </code></pre>
  
  <p>On server side I am using Smack Api to get the roster list(online)</p>
  
  <pre><code>public void usersOnline() {
      Roster roster = connection.getRoster();
      Collection&lt;RosterEntry&gt; entries = roster.getEntries();
      System.out.println(roster.getEntryCount());
      int count1 = 0;
      int count2 = 0;
      for (RosterEntry r : entries) {
          String user = r.getUser();
          Presence presence = roster.getPresence(user);
          if (presence.getType() == Presence.Type.available) {
              System.out.println(user + " is online");
              count1++;
  
          } else {
              System.out.println(user + " is offline");
              count2++;
          }
  </code></pre>
  
  <p>Now should I return the data as JSON or is there a way DWR can handle the collection???</p>