simple AJAX/JSP example: sum of two numbers

It’s been a while since I’ve done any front-end Web programming, so when Eva proposed a friendly challenge to quickly create a simple AJAX calculator, I gladly accepted. It took her about 20 minutes on an ASP.NET stack, and took me… *cough* …a couple of hours using JSP.

The challenge was fun because I played with and gained respect for JQuery and the Eclipse WTP. I think it took me longer than Eva because I first looked for tiny AJAX examples in Ruby on Rails and Django. After a couple of aborted attempts, I decided to use JSP after finding this nice example.

I’m sharing my result since I wasn’t able to find one quite as succinct. You can throw the war file in a Tomcat “webapps” directory or import it into Eclipse (ideally the Java EE version with WTP) to hack it. The WTP even has a nifty HTML WYSIWYG design view.