Alex Rivera | Logout

Alternatives to DWR (www.directwebremoting.org)

Asked 2009-09-19T05:33:44.403
14

I've been a big of DWR (www.directwebremoting.org) in the past and have used it on a few projects. It makes AJAX easy by creating javascript proxy / stubs to java classes on the server.

While DWR has been around for years it seems to have slowed down ever since the main developer moved on - it's also quite large compared to it's early days.

As far as the need for a simply java to javascript proxying/marshelling (essentially abstract the lower level AJAX stuff) - can anyone recommend an alternative? All I have found is RAJAX but that is quite dated as well.

Thanks!!

Edit
Report

2 Answers

3

You can use jQuery for your Java Script interaction. With jQuery UI and the scores of jQuery plugins you can create powerful user interfaces.

That takes care of the front-end parts but you still need to get the server communication. In the simplest case you can use jQuery's getJSON method to fetch data from the server.

The server need to respond with something that looks like JSON. You can use something like JSON taglibs or JSON object models. In fact jQuery won't care where the JSON came from so a simple JSP (or servlet) would also do:

 <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="1.2">
 <jsp:directive.page contentType="text/json"/>
  {
     "firstName": "John",
     "lastName": "Smith",
     "address": {
         "streetAddress": "21 2nd Street",
         "city": "New York",
         "state": "NY",
         "postalCode": "10021"
     },
   }
 </jsp:root>

JSON is a good choice because it works easily with many JavaScript libraries and it doesn't tie you to any server side language/library/technology.

answered 2009-09-19T08:08:16.260
1

I use jQuery on client side and Jersey on server side. They let you free to use xml, json or both.

answered 2013-02-19T08:24:10.310

Your Answer