现在选择 Java Web 框架?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2084169/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-13 03:22:22  来源:igfitidea点击:

Choosing a Java Web Framework now?

javajakarta-eeweb-frameworks

提问by cosmos

we are in the planning stage of migrating a large website which is built on a custom developed mvc framework to a java based web framework which provides built-in support for ajax, rich media content, mashup, templates based layout, validation, maximum html/java code separation. Grails looked like a good choice, however, we do not want to use a scripting language. We want to continue using java. Template based layout is a primary concern as we intend to use this web application with multiple web sites with similar functionality but radically different look and feel.

我们正处于将基于自定义开发的 mvc 框架构建的大型网站迁移到基于 Java 的 Web 框架的规划阶段,该框架提供对 ajax、富媒体内容、混搭、基于模板的布局、验证、最大 html/的内置支持java代码分离。Grails 看起来是一个不错的选择,但是,我们不想使用脚本语言。我们想继续使用java。基于模板的布局是一个主要关注点,因为我们打算将此 Web 应用程序与具有相似功能但外观和感觉完全不同的多个网站一起使用。

Is portal based solution a good fit to this problem?

基于门户的解决方案是否适合这个问题?

Any insights on using "Spring Roo" or "Play" will be very helpful.

任何有关使用“Spring Roo”或“Play”的见解都会非常有帮助。

I did find similar posts like this, but it is more than a year old. Things have surely changed in the mean time!

我没有找到类似的职位像这样,但它是一个多岁。与此同时,事情肯定发生了变化!

EDIT 1:Thanks for the great answers! This site is turning to be the best single source for in-the-trenches programmer info. However, I was expecting more info on using a portal-cms duo. Jahia looks goods. Anything similar?

编辑 1:感谢您的精彩回答!这个站点正在成为最好的程序员信息的单一来源。但是,我期待更多有关使用 portal-cms 二人组的信息。Jahia 看起来有货。有没有类似的?

采纳答案by Pascal Thivent

Is portal based solution a good fit to this problem?

基于门户的解决方案是否适合这个问题?

Personally, I would stay away from big fat Portal solutions (they are often productivity killers). I've heard good things about Gateinthough but I don't have any real experience with it.

就个人而言,我会远离大型门户解决方案(它们通常是生产力杀手)。我听说过关于Gatein 的消息,但我没有任何实际经验。

Any insights on using "Spring Roo" or "Play" will be very helpful.

任何有关使用“Spring Roo”或“Play”的见解都会非常有帮助。

About Spring Roo, I've read previous answers like Spring roo Vs (Wicket and Spring)and other things over the Internet but I'm still not convinced (maybe I don't get it), I'm not sure of its maturity, and, more important, I'm really wondering what SpringSource is doing with Grails and Roo (no, Grails vs Roo - why SpringSource is pushing two very similar technologies?doesn't convince me that they will both survive).

关于 Spring Roo,我已经在 Internet 上阅读了诸如Spring roo Vs (Wicket 和 Spring)等以前的答案,但我仍然不相信(也许我不明白),我不确定它的成熟度,而且,更重要的是,我真的很想知道 SpringSource 对 Grails 和 Roo 做了什么(不,Grails 与 Roo - 为什么 SpringSource 正在推动两种非常相似的技术?并不能让我相信它们都会存活下来)。

I can't say much about Play. I've seen the demo like everybody but I would like to read real life feedback. Until then, I'll wait.

关于 Play,我不能说太多。我和每个人一样看过演示,但我想阅读现实生活中的反馈。到那时,我会等。

I did find similar posts (...). Things have surely changed in the mean time!

我确实找到了类似的帖子(...)。与此同时,事情肯定发生了变化!

Yes and no :) But let's enter the presentation frameworks hell: there is no single answer to your question (like one year ago), there are dozen of frameworks around there and no clear winner. Just to cite a few:

是也不是 :) 但是让我们进入演示框架的地狱:您的问题没有单一的答案(就像一年前一样),那里有十几个框架并且没有明确的赢家。仅举几例:

  • JSF: Lots of skeptics about this component based framework, including me so I'm not the best one to talk about it but...
  • JSF 2 (+ CDI/Weld): JSF skeptics are encouraged (by Gavin King) to "take a second look". Indeed, I think that JSF 2 is a big improvement, especially with CDI, but... it is still pretty new (understand, it lacks of feeback). If you want to embrace Java EE 6, check it out though.
  • Wicket: Another component based framework that is getting more an more attention. I hear mostly good things about it: simpler than JSF, nice design, high testability, HTML designer friendly, etc. You may like it.
  • Tapestry: Just don't (see Why did you stop using Tapestry?)
  • Struts 2, Spring MVC, Stripes: Action based frameworks. All decent and will cover your needs(personally, I like Stripes and its convention over configuration approach, see Stripes vs. Struts2to get an idea of it).
  • GWT, Flex, Grails: These aren't maybe not what you're looking for. I can't really talk about (recent versions) of Flex and GWT but I know that Grails does havesomefans.
  • JSF:很多人对这个基于组件的框架持怀疑态度,包括我在内,所以我不是谈论它的最佳人选,但是......
  • JSF 2 (+ CDI/Weld):鼓励 JSF 怀疑论者(由 Gavin King)“再看一遍”。事实上,我认为 JSF 2 是一个很大的改进,尤其是对于 CDI,但是......它仍然很新(理解,它缺乏反馈)。如果您想拥抱 Java EE 6,请查看它。
  • Wicket:另一个受到更多关注的基于组件的框架。我听到的大多是关于它的优点:比 JSF 简单、漂亮的设计、高可测试性、HTML 设计器友好等。您可能会喜欢它。
  • Tapestry:只是不要(请参阅您为什么停止使用 Tapestry?
  • Struts 2、Spring MVC、Stripes:基于动作的框架。一切都不错,将满足您的需求(就个人而言,我喜欢 Stripes 及其约定优于配置方法,请参阅Stripes 与 Struts2以了解它)。
  • GWT、Flex、Grails:这些可能不是您要找的。我不能真正谈论(最近版本)Flex 和 GWT,但我知道 Grails 确实一些粉丝

Actually, I'd suggest to take a look at Matt Raible's presentations, he really did a great job at comparing web frameworks, showing their strengths and weakness, gathering facts and numbers, showing trends... I recommend:

实际上,我建议看看 Matt Raible 的演讲,他在比较 Web 框架、展示它们的优缺点、收集事实和数字、展示趋势方面做得非常出色……我建议:

Really, have a look at these presentations, they will help you to find an appropriate framework (there is no unique answer but you can restrict the choice by elimination) and might change your point of view.

真的,看看这些介绍,它们会帮助你找到一个合适的框架(没有唯一的答案,但你可以通过排除来限制选择)并且可能会改变你的观点。

回答by D.C.

I would second the Spring recommendation. I'm not a huge fan GWT, I don't think the Java -> Javascript crosscompiler is quite there yet. I am working on an AJAX app that uses spring on the server and jQuery on the client. Although there is technically not "out-of-the-box" support for jQuery, implementing a spring-MVC AjaxView is dead simple and took about 25 lines of code.

我会支持 Spring 的建议。我不是 GWT 的忠实粉丝,我不认为 Java -> Javascript 交叉编译器已经存在。我正在开发一个 AJAX 应用程序,它在服务器上使用 spring,在客户端上使用 jQuery。尽管在技术上没有对 jQuery 的“开箱即用”支持,但实现 spring-MVC AjaxView 非常简单,只需要大约 25 行代码。

回答by Mihir Mathuria

Ext GWT + Spring

扩展 GWT + 弹簧

回答by Bozho

The top three choices for me are (alphabetically):

我的前三个选择是(按字母顺序):

They:

他们:

  • have good ajax support
  • allow you making actual web-sites, not applications (like GWT)
  • stable, well-documented, widely used
  • MVC
  • pure Java
  • easy integration with Spring as middleware
  • 有很好的ajax支持
  • 允许您制作实际的网站,而不是应用程序(如 GWT)
  • 稳定,有据可查,广泛使用
  • MVC
  • 纯Java
  • 作为中间件与 Spring 轻松集成

回答by user252942

JSF is a nice framewrok, but JSF 1.2 lacked vision for years to come from its release. JSF 2.0 looks promising and has many new things added fro m JSF 1.2 like ajax support, facelets, Annotation support and default conventions (less XML),easy component building than 1.2.

JSF 是一个不错的框架,但 JSF 1.2 在发布后多年缺乏远见。JSF 2.0 看起来很有前途,并且从 JSF 1.2 添加了许多新东西,例如 ajax 支持、facelets、注释支持和默认约定(较少的 XML),比 1.2 更容易构建组件。

It integrates well with Spring also, if you are concerned for DI support.

如果您担心 DI 支持,它也可以与 Spring 很好地集成。

回答by Gerard Banasig

Play is closely similar to ROR, a ROR version in java

Play 与 ROR 非常相似,是 Java 中的 ROR 版本

回答by bert

Top choice for me is Wicket. Clear separation of markup and java code. Very easy to write and use components. Simple to use Ajax, testability. You can debug right into your pages / components and don't get cryptic error messages from your JSF implementation ;)

我的首选是Wicket。标记和 Java 代码的清晰分离。非常容易编写和使用组件。Ajax 使用简单,可测试性强。您可以直接调试到您的页面/组件中,并且不会从您的 JSF 实现中获得神秘的错误消息;)

There is also a good comparison wicket <--> JSF in terms of performance

还有一个很好的比较检票口< - > JSF在性能方面

回答by James B

I've found stripesto be really effective and surprisingly lightweight....it aims to be more lightweight than struts. I've heard from friends that are fulltime web developers that JSF is not worth bothering with, although I have no firsthand experience, and can't back that up with examples (!).

我发现条纹真的很有效,而且非常轻巧……它的目标是比struts更轻巧。我从全职 Web 开发人员的朋友那里听说 JSF 不值得打扰,尽管我没有第一手经验,也不能用例子来支持(!)。

回答by Syed M Shaaf

I think what you are looking for is something close to Jahia. It supports GWT, Mashups, Media Content etc.

我认为您正在寻找的东西与 Jahia 很接近。它支持 GWT、混搭、媒体内容等。

http://www.jahia.org/cms/lang/en/home/Jahiapedia/Jahia_Templateshttp://www.jahia.net/downloads/jahia/jahia6.0.0/readme/index.html

http://www.jahia.org/cms/lang/en/home/Jahiapedia/Jahia_Templates http://www.jahia.net/downloads/jahia/jahia6.0.0/readme/index.html

回答by Sébastien Deleuze

Have a look to RESThub, that follow the same principles that Play! but implemented by reusing some enterprise grade frameworks/tools like Maven 3/Spring 3/Jersey/jQuery.

看看RESThub,它遵循与 Play 相同的原则!但通过重用一些企业级框架/工具(如 Maven 3/Spring 3/Jersey/jQuery)来实现。

RESThub is very disruptive comparing to other frameworks since it is a full stack toolkit, but without any serverside MVC or servlet based framworks. Instead, it use a jQuery UI based GUI that use JAX-RS (REST) webservices and a Javascript templating system based on embeddedJs.

RESThub 与其他框架相比非常具有破坏性,因为它是一个完整的堆栈工具包,但没有任何基于服务器端 MVC 或 servlet 的框架。相反,它使用基于 jQuery UI 的 GUI,使用 JAX-RS (REST) 网络服务和基于 EmbeddedJs 的 Javascript 模板系统。

Servers are stateless, and we use HTML5 sessionStorage to keep session on client side. This approach is design for RIA and scalability.

服务器是无状态的,我们使用 HTML5 sessionStorage 在客户端保持会话。这种方法是为 RIA 和可扩展性设计的。

Some demo applications are provided (even if under construction).

提供了一些演示应用程序(即使正在建设中)。