当前位置: 动力学知识库 > 问答 > 编程问答 >

struts2 - most commonly used AJAX library with Struts 2?

问题描述:

I need to integrate AJAX functionality into a Struts 2 web application. I was looking at some tutorials and was going to try using the Dojo Plugin but quickly realized it has been deprecated as of Struts 2.1.

The AJAX documentation for Struts 2 gives a lot of potential solutions and I'm trying to narrow it down a little.

I realize this question is a little general and there are some existing Questions here about specific alternatives, but I'd like to get a feel from the community as to what is the most commonly used approach.

I'm also interested in whether it is more common to use one of the AJAX taglib plugins (ie. struts2-jquery) or straight AJAX widgets independent of Struts.

I understand the basic concepts of AJAX but don't have much hands-on experience with any of the libraries. I don't mind putting in some time getting up to speed on something if necessary.

Thanks much for any suggestions!

网友答案:

I'd recommend doing it manually via some JS library and them moving to a taglib plugin once you understand exactly what the plugin is abstracting away for you. I think that getting that hands-on experience with the libraries is a better educational / training investment. That way when you move on to another web framework you'll have a better understanding of the javascript API side of things.

jQuery is probably your best choice so you could move on to the struts2-jquery plugin if you decide it's worth it. The Struts 2 jQuery plugin is actively maintained (albeit a few versions behind on jquery/jquery-ui) and I have friends that are using it quite happily. Still, I personally tend to stick with direct jQuery ajax calls to Struts 2 actions that return JSON or FreeMarker snippets for autocompletion, updating search results, etc.

网友答案:

Use whatever JS framework(s) you want to and don't bother with a plugin unless it offers you a compelling reason to use it.

If you haven't used a JS framework before and are looking for suggestions, I'd recommend jQuery.

分享给朋友:
您可能感兴趣的文章:
随机阅读: