Which Java web framework to choose for jQuery?

前端 未结 6 1923
野的像风
野的像风 2020-12-14 05:29

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?

6条回答
  •  忘掉有多难
    2020-12-14 05:57

    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 . In RichFaces, there's even a special component to fire jQuery functions and keep the server side state updated, the .

    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?

提交回复
热议问题