简体   繁体   English

AJAX应用程序的哪个Java Web开发框架?

[英]Which Java web development framework for an AJAX application?

I read through a few threads ( simple web framework , java web development , etc). 我通读了一些线程( 简单的Web框架Java Web开发等)。 Very informative. 非常丰富。 However I have not seen a focus on the AJAX side of things. 但是,我还没有看到对AJAX方面的关注。 For the app I am trying to create, most of the client side will be written in Google GWT, and JSON will be used to communicate with the server side. 对于我尝试创建的应用程序,大多数客户端将用Google GWT编写,而JSON将用于与服务器端进行通信。 In that case, all templating is pretty much useless. 在这种情况下,所有模板都几乎没有用。

For my purposes, which framework would be the simplest to setup and easiest to learn? 就我的目的而言,哪种框架最容易设置且最容易学习?

Thanks. 谢谢。

To clarify, I want a server side framework. 为了澄清,我想要一个服务器端框架。 GWT is great for client side, but I need something to generate json responses on the server side. GWT非常适合客户端,但是我需要一些东西来在服务器端生成json响应。

None at all, most likely: GWT is framework enough, given that's what you're using. 根本没有可能,因为您正在使用GWT,所以GWT足够框架。 The only reason I can think of to add anything else might be if there was some special effect you absolutely craved (but if you've chosen to go GWT, my recommendation would be to give up on such special effects), 我想添加其他任何东西的唯一原因可能是如果您绝对渴望某些特殊效果(但是如果您选择了GWT,我的建议是放弃这种特殊效果),

Ajax/JS by nature functions mostly on client side and you want to use it but want to run it on server side? Ajax / JS本质上主要在客户端运行,而您想使用它却想在服务器端运行它? Are you sure you're not trying to hammer a square block into a round hole? 您确定不打算将方形块锤入圆孔吗?

Reading through your question it seems to me what you're really asking is for a way to abstract a layer which provides JSON for your client side UI. 仔细阅读您的问题,在我看来,您真正要问的是一种抽象为客户端UI提供JSON的层的方法。 Most web frameworks such as GWT deliberately abstract this part away but still include it in their inner workings: it would indeed be rather stupid for an Ajax web framework not to support data transfer between the view layer and the rest of the system! 诸如GWT之类的大多数Web框架都故意将这部分抽象化,但仍将其包含在其内部工作中:对于Ajax Web框架,不支持视图层与系统其余部分之间的数据传输,确实是很愚蠢的!

However, if you really want to create your own custom component for serving JSON, then I suggest you take a good look at Servlets and mix that with any of the gazillion available JSON libraries listed at JSON.org . 但是,如果您真的想创建自己的自定义组件来提供JSON服务,那么我建议您对Servlet进行仔细研究,并将其与JSON.org上列出的所有可用的JSON库混合使用

And if you still really, really want to run your client side view logic on server, Vaadin could do the trick for you. 而且,如果您仍然真的要在服务器上运行客户端视图逻辑,那么Vaadin可以为您解决问题。 In practice Vaadin really runs GWT on the server side and just serves static stuff generated by the server side GWT but from what I've understood the difference has been abstracted away. 实际上,Vaadin确实在服务器端运行GWT,并且只提供服务器端GWT生成的静态内容,但是据我所知,区别已经被抽象化了。

A huge word of warning though, for me it sounds like you really want to reinvent the wheel here while you shouldn't. 不过,这是一个很大的警告,对我来说,听起来好像您真的想在这里重新发明轮子,而您不应该这样做。 You really should reconsider your architecture and/or deepen your knowledge of GWT and web frameworks in general, the "framework" part usually hints that it's not just the V from MVC Model 2 but at least V and with M bindings. 通常,您确实应该重新考虑您的体系结构和/或加深对GWT和Web框架的了解,“框架”部分通常暗示它不仅是MVC Model 2中的V,而且至少是V并且带有M绑定。

I've had pretty good luck with the Dojo Toolkit . 我使用Dojo Toolkit感到非常幸运。 Make sure to download the full toolkit (Dojo, Dijit and Dojox) which you'll find at the downloads page. 确保下载完整的工具包(Dojo,Dijit和Dojox),该工具包可在下载页面上找到。

Their 'Hello World' tutorial is pretty useful for getting started. 他们的“ Hello World”教程对于入门非常有用。

You could could give IceFaces a try. 您可以尝试一下IceFaces It's a Ajax framework based on faces technology. 这是一个基于Faces技术的Ajax框架。 Works really great and magically, also comes with a good documentation and tutorial. 真的很棒,而且神奇,还附带了很好的文档和教程。

You should look at one of the REST based frameworks, like Jersey , Restlets , or RESTEasy . 您应该查看基于REST的框架之一,例如JerseyRestletsRESTEasy

The main reason is that these frameworks make binding and working with JSON easy. 主要原因是这些框架使绑定和使用JSON变得容易。 Most of the other systems are designed for HTTP POST encoded data, which is not JSON. 其他大多数系统都是为HTTP POST编码的数据(不是JSON)设计的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM