6

I am searching for a Java web framework which let me use jQuery to it full power like ASP.NET MVC on the .NET platform.

Any recommendations?

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
Laurent Kempé
  • 751
  • 9
  • 21

6 Answers6

16

If you want to go crazy with jQuery in Java, then rather look for a request/action based MVC framework like Struts 1.x, Spring MVC, Stripes or Play, etc. Of them, Spring MVC is IMHO the most decent.

Component based MVC frameworks like JSF, Struts 2.x, Wicket, Echo, GWT, etc allows less fine grained control over the output. You've got to do some specific hacks/workarounds to let jQuery seamlessly communicate with the component tree in the server side. E.g, enabling a disabled HTML checkbox by $('#elementid').attr('disabled', false) isn't enough. You've got to notify the server side somehow about the change in the view state as well, otherwise it still thinks that it is disabled and thus won't apply/process any submitted request parameter.

In some of them, especially JSF component libraries like PrimeFaces and RichFaces, jQuery (UI) is integrated as part of look'n'feel and/or to do "the Ajax works". In PrimeFaces, for example the jQuery UI accordion is implemented as a <p:accordionPanel>. In RichFaces, there's even a special component to fire jQuery functions and keep the server side state updated, the <rich:jQuery>.

All in all, a request/action based MVC framework is the best choice if you want full jQuery freedom. A component based MVC framework which offers libraries with jQuery integrated is a sufficient choice if you don't necessarily need to have 100% client side freedom.

See also:

Community
  • 1
  • 1
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
  • @The: "Go crazy with jQuery". Not that I would ever recommend Struts 1.x :) – BalusC Dec 09 '10 at 00:13
  • I finally went for Spring MVC and I am really happy about it at the moment. – Laurent Kempé Jan 21 '11 at 08:16
  • @BalusC please would you take a look my question at http://stackoverflow.com/questions/11450714/notify-jsf-server-side-about-changes-on-dom-client-state-made-by-jquery-ajax/11450920#comment15113546_11450920 I tried to use Jquery and JSF.. and indeed Im going out of mind with (client) state synchronisation... a hand would be helpful – arthur Jul 12 '12 at 15:34
1

Checkout Grails. It has the same feeling as ASP.NET MVC. It is not Java, but Groovy, a dynamic language built with Java. But the syntax of Groovy is similar to Java.

Or you can try Stripes if you want pure Java, eventhough it is not a fullstack framework like Grails.

Joshua Partogi
  • 16,167
  • 14
  • 53
  • 75
0

I recommend Struts 2 framework. It also has a jquery plugin, which let you develop your client with jQuery more easily.

Lots of jQuery UI Components are ready in this plugin and also you can add other jQuery library too.

The sample showcase can be found at http://struts.jgeppert.com/struts2-jquery-showcase

Alireza Fattahi
  • 42,517
  • 14
  • 123
  • 173
0

This isn't a question that can be answered. Unlike the .NET world, the Java world has many options (some say too many) when it comes to web frameworks. Everyone has their favorite. The best thing for you to do is try out a few and see which works best for you.

Gregg
  • 34,973
  • 19
  • 109
  • 214
  • I don't search for the favorite of someone, I search for one which let me work efficiently with jQuery and XHTML. For sure there are a lot, this is why I ask the question. I tried several Java web frameworks, JSF, Icefaces, Vaadin, GWT. At the moment none of those give me the control I want on the way to expose service end point which I can call from jQuery, or they don't really give me the control on the outputed XHTML – Laurent Kempé Dec 08 '10 at 21:59
  • Of course those types of frameworks don't give you full control. GWT isn't meant to be used with anything but GWT, vaadin uses its own client libraries (including some GWT), and I already mentioned in a comment why JSF isn't the way to go. Look at frameworks like Grails, Stripes, SpringMVC, etc. Request based frameworks. – Gregg Dec 08 '10 at 22:01
  • Thanks Gregg I will look into that direction. – Laurent Kempé Dec 08 '10 at 22:08
0

Every webframework where you have full control over your html. Thus JSF is not an option and ASP MVC does not let you use the full power of jquery. This can be achieved even with plain html.

But personally I like grails.

Christian
  • 3,503
  • 1
  • 26
  • 47
0

FYI, jQuery was ported to GWT : GwtQuery Maybe a good compromise for those they want to use java and an api looking like jQuery

jdramaix
  • 1,104
  • 6
  • 9