开发者

Which Java web framework to choose for jQuery?

开发者 https://www.devze.com 2023-01-29 19:36 出处:网络
I am searching for a Java web framework which let me use jQuery to it f开发者_如何学运维ull power like ASP.NET MVC on the .NET platform.

I am searching for a Java web framework which let me use jQuery to it f开发者_如何学运维ull power like ASP.NET MVC on the .NET platform.

Any recommendations?


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?


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.


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.


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.


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


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

0

精彩评论

暂无评论...
验证码 换一张
取 消