Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which Java web framework to choose for jQuery?

Tags:

java

jquery

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?

like image 581
Laurent Kempé Avatar asked Dec 08 '10 21:12

Laurent Kempé


2 Answers

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:

  • Difference between Request MVC and Component MVC
  • What is the need of JSF, when UI can be achieved from CSS, HTML, JavaScript, jQuery?
like image 84
BalusC Avatar answered Sep 18 '22 22:09

BalusC


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.

like image 39
Joshua Partogi Avatar answered Sep 20 '22 22:09

Joshua Partogi