Posts Tagged ‘spring dwr integration’

Configuring DWR 3.0 with spring using annotations

Saturday, February 21st, 2009

I’m a fan of the spring framework and I have recently become a fan of DWR as well. Both of them together are just unstoppable, they take ajax and bean exposure through javascript to a new level. I have written about my experiences integrating the two and about validating forms using ajax. I’d advise you to read at least the integration article before continuing.

Using annotations to configure the spring container is a very useful feature, a majority of developers prefer to use annotations rather than XML files. However, annotation driven configuration of DWR through spring was not possible in older versions of DWR. The new version however, allows such configuration and with ease I might add. You can now use DWR with spring with almost no configuration in your XML files(a little bit of configuration is required but it doesn’t go beyond 10 lines or so). The best part however is that you don’t need to configure a seperate servlet for DWR at all, all calls to dwr can be routed through the spring dispatcher servlet which helps cut down configuration even more. (more…)

Dwr + Spring integration example

Saturday, February 7th, 2009

I like DWR, it’s a very strong framework for enriching your simple web application with ajax. It’s particularly useful for java developers because no one likes to write javascript to make XMLHttpRequest’s to call the server, parse the response and then set stuff in your jsp so that the response is displayed in a proper manner. You can effectively expose your entire class simply by defining it’s methods in your dwr.xml and then writing converter’s for your objects. The util.js that comes with dwr is very useful too even if you aren’t using dwr, it provides a lot of helpful methods to do stuff in javascript.

The debug page is probably what I loved the most about dwr. It lists out what classes have been exposed including their methods in a very simple manner. You can immediately test if you have configured dwr and if it’s working properly. You can also test out your exposed methods, with and without parameters, and see their responses. It’s lovely and I wish more applications would do this.

Running DWR with spring however is a (more…)