java Spring 3 的最佳视图层是什么?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2386348/
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
What is the best view layer for Spring 3?
提问by Piotr Gwiazda
I'm investigating presentation layers to be used with spring in our new project. I'm coming from PHP+Prado and want to move to something what is as simple as Prado and more powerfull than PHP.
我正在研究在我们的新项目中与 spring 一起使用的表示层。我来自 PHP+Prado,希望转向与 Prado 一样简单且比 PHP 更强大的东西。
I like Spring 3 and Spring MVC. It's very simple to learn and start working with. But I'm looking for "view framework" better than simple jsp. I need simple components as Datagrids, Lists, Trees drag-and-drop supported. I've created SpringMVC+Spring Web Flow 2 + Spring Faces + JSF configuration but it's very complicated to create simple things there. I need something simpler.
我喜欢 Spring 3 和 Spring MVC。学习和开始工作非常简单。但我正在寻找比简单的 jsp 更好的“视图框架”。我需要简单的组件,如数据网格、列表、树拖放支持。我已经创建了 SpringMVC+Spring Web Flow 2 + Spring Faces + JSF 配置,但是在那里创建简单的东西非常复杂。我需要更简单的东西。
Do You have any ideas ?
你有什么想法 ?
采纳答案by BalusC
In Java EE there are currently only 2 view technologies: JSP and Facelets. JSP is old and about to retire. Facelets is newer and better and designed with JSF in mind so that they both fits smoothly in each other.
在 Java EE 中,目前只有两种视图技术:JSP 和Facelets。JSP 已经过时了,即将退休。Facelets 更新更好,并且在设计时考虑到了 JSF,因此它们可以顺利地相互配合。
But Spring MVC and JSF are in fact competitors. They both have roughly the same goals and purposes. You should use the one or the other and not mix up them. Mixing two or more MVC frameworks in one page ain't going to work flawlessly. You can however use Spring as DI and/or Security framework in combination with JSF as MVC framework. Spring offers much more than only MVC.
但 Spring MVC 和 JSF 实际上是竞争对手。他们都有大致相同的目标和目的。您应该使用其中一种,而不是混淆它们。在一页中混合两个或多个 MVC 框架不会完美无缺。但是,您可以将 Spring 作为 DI 和/或 Security 框架与 JSF 作为 MVC 框架结合使用。Spring 提供的不仅仅是 MVC。
Components like Datagrids, Lists, Trees drag-and-drop supported are not all available in the basicJSF Component implementation. For that you'll need a component library such as PrimeFaces.
在基本的JSF 组件实现中,并非所有支持数据网格、列表、树拖放的组件都可用。为此,您需要一个组件库,例如PrimeFaces。
See also
也可以看看
回答by Damo
I've used Jboss Seam + Richfaces for the last 3 years and find them both useful, but if I were you I'd also check out the Play Framework. It has Spring supportand combined with jQuery UIor ExtJSyou would get a very simple but highly effective environment. Certainly one reminiscent of developing in PHP from a speed point of view.
在过去的 3 年里,我一直在使用 Jboss Seam + Richfaces 并发现它们都很有用,但如果我是你,我也会查看Play Framework。它具有Spring 支持并与jQuery UI或ExtJS相结合,您将获得一个非常简单但高效的环境。当然,从速度的角度来看,这让人想起用 PHP 开发。
回答by skaffman
If you want those sort of rich controls, then some kind of JSF framework is the way to go. The standard JSF framework is rather poorly designed and inelegant, though.
如果您想要那些丰富的控件,那么某种 JSF 框架就是您要走的路。然而,标准的 JSF 框架设计得相当糟糕且不优雅。
You should have a look at JBoss Seamas an alternative. It's a top-to-bottom web framework that uses EJB3 and JSF, and it's pretty well integrated, making JSF a lot easier than it would otherwise be.
您应该看看JBoss Seam作为替代方案。它是一个使用 EJB3 和 JSF 的自上而下的 Web 框架,并且集成得非常好,使 JSF 比其他方式更容易。
It's not Spring-based, though, so if your heart is set on Spring, then you need to look at other JSF implementations such as RichFaces.
但是,它不是基于 Spring 的,因此如果您的心是 Spring,那么您需要查看其他 JSF 实现,例如RichFaces。
Spring WebFlow probably isn't necessary for you at all, so I;d ignore that unless you have a good reason.
Spring WebFlow 对您来说可能根本不需要,所以除非您有充分的理由,否则我会忽略它。
回答by Padmarag
回答by naaka
回答by ddsultan
Angular or GWT could also be an alternative with proper usage.
Angular 或 GWT 也可以是正确使用的替代方案。
回答by Tony Murphy
As you are coming from PHP, JSP is probably a more suitable view technology than JSF
由于您来自 PHP,因此 JSP 可能是比 JSF 更合适的视图技术
If you have to use Spring, use Spring 4 (not 3)
如果必须使用 Spring,请使用 Spring 4(而不是 3)
Checkout Spring Boot for more rapid development etc..
签出 Spring Boot 以获得更快速的开发等。
If you are developing a web application, and SEO isn't important, I would personally go down the Single Page Root with a Javascript Framework + Restful web services. I notice you mention Spring WebFlow + Components. My opinion is these are too heavyweight
如果您正在开发一个 Web 应用程序,而 SEO 并不重要,那么我个人会使用 Javascript 框架 + Restful Web 服务向下浏览单页根目录。我注意到您提到了 Spring WebFlow + Components。我的意见是这些太重量级了
If SEO is important, then checkout the Play Framework (I prefer Scala version) with SSP (Scala Server Pages).
如果 SEO 很重要,那么请使用 SSP(Scala 服务器页面)检查 Play 框架(我更喜欢 Scala 版本)。

