Take the 2-minute tour ×

I've got a very simple need and I don't know what are the options available.

If I simplify, users see webpage like this server by a Java webapp server:

[-] red
[x] green
[-] blue
[-] yellow

The selected color is green

And then I want the user to be able to select the yellow color and have the part of the page containing the relevant text change to:

[-] red
[-] green
[-] blue
[x] yellow

The selected color is yellow

Basically I want something a bit more user friendly than simply using HTTP GET all the time. There shall be a lot of options the user can select from and this shall affect an (HTML formatted) text displayed on the page. And I want the user to see his change as soon as possible, without having the page to fully reload and without being redirected to another page. There shall be a client/server round-trip (the information to display depending on the options selected ain't available on the client-side so I cannot do it all in JavaScript in the browser).

I'd like to use Ajax requests but I don't know which way to go:

  • jQuery

  • GWT

  • something else

What are my options and what would be the pros and cons of the various approach?

P.S: I'm very familiar with Java (SCP since the last century and basically being a Java programmer for the last 12 years or so) but not familiar at all with JavaScript (though I did hack a few Ajaxy-calls years ago, way before great libraries existed).

share|improve this question
add comment

4 Answers

up vote 2 down vote accepted

Do you use any known web framework? Some frameworks like Wicket have built in Ajax functionality, you might want to check whether your framework supports Ajax out of the box.

GWT is an overkill IMO for your case, you will be fine with any lightweight framework like jQuery or MooTools.
If your application is going to be a heavy Ajax one, then I suggest you check JavaScriptMVC or Backbone.js frameworks. Those will help you to maintain a clean and elegant structure.

share|improve this answer
+1... it's really very simple so there's no framework so far, just JSPs. But I could use a framework if it helps. Apparently several people are commenting on Wicket so I'll probably give that a look. –  Cedric Martin Nov 21 '11 at 14:02
add comment

I use Prototype and jQuery for Ajax calls at work. They're pretty much the same. You pass a URL, a map of parameters and a callback function (maybe different callback functions for success/failure etc. if you want)

http://api.jquery.com/category/ajax/ is the Ajax section of jQuery.

share|improve this answer
add comment

Modern Java web frameworks usually support partial updates via Ajax directly. For example, in both Wicket and JSF, a button can be specified to trigger an Ajax request rather than a normal submit, and given a list of components whose content will be updated in the response.

share|improve this answer
add comment

Take a look at DWR. It's a nice interface between javascript and server-side java methods.


share|improve this answer
@WillQu, just wondering, are you using DWR yourself or just heard about is usage? –  shabunc Nov 21 '11 at 12:39
@shabunc, I'm using it. –  WilQu Nov 21 '11 at 14:32
add comment

Your Answer


