我应该选择哪个框架 - Seam、Wicket、JSF 还是 GWT?

发布于 2024-07-16 09:09:13 字数 156 浏览 7 评论 0原文

我正在考虑是否使用 Seam、Wicket、JSF 还是 GWT 作为 Java 项目中表示层的基础。

根据就业市场的考虑、技术的新颖性以及其他 SO 用户的建议,我将 Java Web 框架的选择范围缩小到了这个子集。

在做出这些决定时我应该考虑哪些因素?

I'm debating whether to use Seam, Wicket, JSF or GWT as the foundation for my presentation layer in a Java project.

I narrowed my selection of Java web frameworks down to this subset based on job market considerations, newness of the technology and recommendations from other S.O. users.

What factors should I take into consideration in deciding among these?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(11

美胚控场 2024-07-23 09:09:13

我从 1.4 版本开始就使用 GWT,从 2.0 规范发布以来我就使用 JSF。

GWT 是一个客户端框架,它从 Java 生成 JavaScript。 您的架构将是一个纯粹的客户端-服务器,这意味着:

  • 最好使用粗粒度服务
  • 所有传输到客户端的对象都应该是完全可序列化的(这意味着没有延迟加载或 OpenSessionInView 模式)
  • 从 GWT 2.0 开始,您可以设计你的 gui 使用 xhtml,这在样式和样式方面要容易得多。 构建 HTML
  • GWT 倾向于支持良好的架构,如果你搞砸了,那么重构完美就会糟糕
  • 历史记录(浏览器后退按钮、可添加书签的 url)支持困难,你可能必须自己动手,尽管很容易在前面破解一些东西

JSF 是一个基于组件的框架,具有视图优先的设计(如果你愿意,可以在代码隐藏):

  • 做一些事情更容易Web 应用程序类型(有状态,如购物车)
  • JSF+Seam 支持对话(想想在多个页面之间维护状态的类似向导的页面)
  • 可以实现 OpenSessionInView,具体取决于您的堆栈。 如果您将 EJB 用于服务/业务层,则可能不建议这样做
  • JSF2 对 AJAX 有出色支持,并且使用 RichFaces 之类的组件套件,您可以构建漂亮的 Web 应用程序
    • 但是如果您想要精致的 javascript 行为,则必须编写一些 javascript
  • JSF 来跟踪客户端或服务器端的当前 UI 状态。 这是网络流量或服务器内存之间的权衡。

简历:

  • GWT 更适合需要最佳客户端性能的网络应用程序(例如 gmail)。 编写自定义组件(您编写 Java)很容易,并且由于您的服务器端只是一个服务层,因此您可以在服务器端完全无状态。
  • JSF 更适合大多数 CRUD 应用程序,这些应用程序更适合面向组件的东西:想想酒店/航班预订系统、带有购物车的在线商店等

I've used GWT since version 1.4 and JSF since the 2.0 spec came out.

GWT is a client-side framework, it generates JavaScript from Java. Your architecture would be a pure client-server, which means:

  • Best to use coarse-grained services
  • All objects that travel to the client side should be fully serializable (it means there's no lazy load, or OpenSessionInView pattern)
  • Since GWT 2.0 you can design your gui using xhtml, which is much easier in regards to styling & structuring HTML
  • GWT tends to favour good architecture, if you mess it up it will be bad to refactor
  • Perfect History (browser back button, bookmarkable urls) support is hard, you probably have to roll your own, although it's easy to hack something right up front

JSF is a component-based framework, with a view-first design (code-behind if you like):

  • It's easier to do some type of webapps (stateful, like shopping cart)
  • JSF+Seam have suport for conversations (think wizard-like pages that maintain state across several pages)
  • You can implement OpenSessionInView, depending on your stack. It's probably not recommended if you use EJB for service/business layer
  • JSF2 has superb support for AJAX, and with a component suite like RichFaces you can build nice webapps
    • But if you want exquisite javascript behaviour, you'll have to write some javascript
  • JSF tracks the current UI state in client or server-side. This is a tradeoff between network traffic or server memory.

Resume:

  • GWT is more adequate for web applications (think gmail) that require the best client-side performance. It's easy to write custom components (you write Java) and since your server-side is just a service layer you can be fully stateless on the server side.
  • JSF is more adequate for mostly CRUD applications that are better suited for component-oriented stuff: think a hotel/flight reservation system, an online store with a shopping cart, etc
深居我梦 2024-07-23 09:09:13

我使用过的唯一一个是 JSF,因此我无法向您提供有关其他产品的反馈,但这是我对 JSF 的看法。 根据我的经验,当我们从 JSP 中的 JSF 转换为 Facelets 中的 JSF 时,生活就变得容易多了,所以我将重点关注 Facelets。 而且,看起来 Seam 和 JSF 并不相互排斥。

优点:

  • 创建facelets xhtml 组件很简单,这促进了重用。
  • 使用内置标签(如 ui:insert、ui:include 和 ui:decorate)的良好模板能力
  • 访问 Spring beans
  • 基于 XHTML,因此不熟悉 java 的 Web 开发人员仍然有效
  • 在 tomahawk/trinidad 中提供良好的小部件库

通过 faces-config简单 :

  • 仅发布请求。 这可能会使添加书签变得困难。
  • 不像 GWT 那样内置 ajax-y,但是如果与 Seam 一起使用,这个问题可能会被修复。

我绝不是 JSF/Facelets 方面的专家,所以我确信还有其他我错过的。 希望其他人也能详细说明。

JSF 2.0 更新:

The only one of those I've used is JSF, so I won't be able to give you feedback on the others, but here's my take on JSF. In my experience, the minute we converted from JSF in JSP to JSF in facelets, life got MUCH easier, so I'll focus around facelets. Also, It looks like Seam and JSF are not mutually exclusive.

Pros:

  • Creating facelets xhtml components is simple, which promotes re-use.
  • Decent templating abilities using built in tags like ui:insert, ui:include, and ui:decorate
  • Simple access to Spring beans through faces-config
  • XHTML based so web developers unfamiliar with java can still be effective
  • Good widget library available in tomahawk/trinidad

Cons:

  • Post requests only. This can make bookmarking difficult.
  • Not as built-in ajax-y as GWT, but this may be fixed if used with Seam

I'm by no means an expert in JSF/Facelets, so I'm sure there are others I've missed. Hopefully someone else will also elaborate.

Update for JSF 2.0:

给我一枪 2024-07-23 09:09:13

感谢检票员保持清醒并继续讨论。 我是 wicket 用户,我喜欢它。 我的主要原因是:

  1. 它是一个组件框架。 我喜欢使用组件而不是整页。
  2. 我可以让设计人员在模板和页面上工作,就像我在 java 部件上工作一样

  3. 没有什么新内容学习。 它的“只是 java 和 HTML”

  4. 我喜欢它的 ajax Fallback 机制。 如果浏览器(尤其是移动设备上的浏览器)不支持 javascript,则它会退回到纯 html 并且一切正常。
  5. 它缺少 xml 配置是一个优点,
  6. 它支持我在 Web 应用程序中想要的一切。 例如验证、国际化、后退按钮支持和 Restful URL 等

我以前的经验是 GWT 和 JSF 1.0

Thanks wicket guys for remaining sober and keeping over this discussion. I am a wicket user and i love it. My main reasons are :

  1. Its a component framework. I love working with components as opposed to full pages.
  2. I can let the designers work on the templates and pages as i work on the java parts

  3. There is nothing new to learn. Its "just java and just HTML"

  4. I like its ajax Fallback mechanism. Where there is not javascript support on a browser especially on mobile devices, it falls back to plain html and everything works.
  5. Its lack of xml configuration is a plus
  6. It supports everything i would want in a web application. e.g validation, internationalization, back button support and restful URLs among others

My previous experience is GWT and JSF 1.0

傲娇萝莉攻 2024-07-23 09:09:13

Seam 是一个应用程序框架,而不是真正的表示层。 它最初是为了减轻 JSF 的痛苦而开发的,但现已发展成为一个更通用的依赖注入框架。

我相信您可以将 Seam 与 JSF、Wicket 和 GWT 一起使用。 JSF 支持是主要且出色的; 我不确定其他两个的支持情况如何。

由于您的标准重点似乎是您的技能的适销性,因此我建议通过 Facelets 尝试 Seam 和 JSF。 JSF 是一个被广泛接受的标准,如果您使用 Facelets,实际上使用起来会很愉快。 您可以通过 Richfaces 和 Ajax4jsf 获得灵活的 AJAX 功能。 Seam 或多或少通过 JCP 实现了标准化。

Seam is an application framework, not really a presentation layer. It was originally developed to make JSF less painful, but has evolved into a more general purpose dependency injection framework.

I believe that you can use Seam with JSF, Wicket and GWT. JSF support is primary and excellent; I'm not sure how well the other two are supported.

Since the focus of your criteria seem to be the marketability of your skills, I would suggest trying out Seam and JSF via Facelets. JSF is a well accepted standard and is actually enjoyable to use if you are using Facelets. You can have slick AJAX functionality via Richfaces and Ajax4jsf. Seam is being more or less standardized via the JCP.

A君 2024-07-23 09:09:13

我的经验是,按时间顺序排列:

原始 servlet - (是的,有很多艰苦的工作,但那是早期,我们是热心的海狸!)

JSP - 我认为这是它出来时的 beez neez (如果我们只知道;))

Echo - 很棒的框架,但不适用于需要搜索引擎友好的页面(相同
GWT 的问题)

Wicket - 很棒的框架 - 开发人员完全理解 OO 的概念(与 JSP 和许多其他框架不同),并将所有常见的 OO 细节应用到这个框架中。 如果您欣赏“可重用性”,如果您欣赏封装,如果您欣赏关注点分离,并且如果您喜欢将模型绑定到 UI 代码而不必担心对象编组和其他此类丑陋问题,那么这就是适合您的框架!

My experience is, in chronological order:

Raw servlets - (yeah, lot's of hard work but the it was early days and we were eager beavers!)

JSP - I thought it was the beez neez at the time it came out (if we only knew ;) )

Echo - Awesome framework but not for pages that need to be search engine friendly (same
problem with GWT)

Wicket - Awesome framework - the developers fully understand the concept of OO (unlike JSP and many others) and have applied all the usual OO niceties to this framework. If you appreciate 'reusability', if you appreciate encapsulation, if you appreciate separation of concerns and if you like to bind your model to the UI code without having to worry about object marshalling and other such ugliness then this is the framework for you!

初雪 2024-07-23 09:09:13

从长远来看,我建议使用 Sun 规范支持的技术。 到目前为止,这已被证明可以提供多种实现方式以供选择(通常也是开源实现),而且行为往往得到很好的定义。

这将在维护场景中为您提供帮助,希望您的代码也能及时完成。 编写良好的代码永远存在:)

在这种特殊情况下,我建议使用 JSF。 我只尝试过 1.1 的 Apache 实现,但在 JSP 之上感到很痛苦。 我们将很快对其进行修改 - 我希望研究在 Facelets 上使用 JSF。

In a long term scenario I'd recommend using technologies backed by a Sun specification. This has so far proven to give multiple implementations resulting in choice (frequently also open source implementations), plus behaviour tends to be very well defined.

That will help you in a maintainance scenario, which - hopefully - your code will end up too in time. Well-written code lives forever :)

In this particular scenario I would suggest JSF. I have only tried the Apache implementation of 1.1, but it hurt to be on top of JSP. We are to revise it soon - I expect to look into having JSF on facelets.

£烟消云散 2024-07-23 09:09:13

我经常使用 Wicket 和 GWT。 从未真正学会爱威克特。

我的自我博客http://salk31.blogspot.com/2009/07 /wicket-ajax.html

今天查看 GWT 2.0 uiBinder,让我想起在 Wicket 中必须将 XML 组件树与 Java 创建的组件树相匹配是多么烦人。 对我来说,GWT 的旋转看起来要好得多。

我已经一年多没有使用 Wicket 了,所以也许他们已经解决了很多问题,但是考虑到现代浏览器和 JS 支持,我看不出在服务器上执行所有这些操作的意义(我知道,我知道数据局部性)。

I've used Wicket and GWT pretty heavily. Never really learned to love Wicket.

My ego blogged about it http://salk31.blogspot.com/2009/07/wicket-ajax.html

Looking at GWT 2.0 uiBinder today reminded me how annoying it was in Wicket to have to match the XML component tree with the one created in Java. The GWT spin on this looks vastly better to me.

I've not used Wicket for over a year so maybe they have fixed a lot of this but given modern browser and JS support I can't see the point of doing all this on the server (I know, I know data locality).

雨轻弹 2024-07-23 09:09:13

如果你只考虑就业市场,你应该选择JSF。 但是,我相信 RIA 的未来属于 GWT 和类似 gwt 的客户端技术。

我认为 GWT 最明显的优点是它比服务器端表示层技术(例如 JSF、wicket)具有更好的可扩展性。 因为,服务器不需要存储客户端状态,并且客户端的CPU功率也被使用。这是一个巨大的好处,你不需要在服务器计算机之间序列化客户端状态来实现容错系统。

If you consider only job market , you should choose JSF. But, I belive that the future of RIA belongs to GWT and gwt like client side technologies.

I think that the most obvious upside of GWT, it is better scaleable than server side presentation layer technologies such as JSF, wicket. Because , server does not need to store client state and the client cpu power also are also used.. It is a huge benefit, you dont need to serialize client state between server computers to achive fault tolerant system.

白昼 2024-07-23 09:09:13

我知道现在有点晚了,但是 Framewrok 上已经有很多比较,特别是这个,发生在 Devox 2010 conf 期间:

http://www.devoxx.com/display/Devoxx2K10/Comparing+JVM+Web+Frameworks

这应该可以帮助您选择:)

I know it's a bit late but there is already lot of comparison on Framewrok, espcially this one, wich occured durinf Devox 2010 conf :

http://www.devoxx.com/display/Devoxx2K10/Comparing+JVM+Web+Frameworks

This should help you to choose :)

む无字情书 2024-07-23 09:09:13

我从 JSF(1.1 和 1.2)开始,这非常痛苦,所以我决定在下一个项目中进行更改。 我做了一些研究,决定尝试一下 Wicket,这真是太愉快了。
我也尝试过 JSF 2,但仍然是同样的事情。

它们都是组件框架,但是使用 Wicket 很容易,而使用 JSF 则一团糟。

Wicket over JSF:

  • 在 Wicket 中,HTML 是 HTML。 JSF 有自己的标记。 h:dataTable(表)是无稽之谈。 相信我,Sun工程师在设计它的时候一定是喝醉了。
  • 在 Wicket 中,例如安全性,
  • 使用 JSF 时,导航栏会显示以前的 URL。 真的很奇怪。
  • 在我看来,JSF 非常沉重,而且像 Rich 或 Prime 这样的库甚至更重。
  • 有时,似乎不可能知道正在发生什么。 你总是对着你的计算机大喊大叫,因为你不知道 JSF 为何这样做。

JSF over Wicket:

  • 在 Wicket 中,您将编写更多 Java(与 HTML 的绑定)。 至少,您的 IDE 将提供重构和验证支持。
  • Wicket 中的资源管理有点棘手。
  • JSF 有更多的文档和支持

一个常见的缺陷是会话大小是个问题(因为图形组件存储在其中)。

总而言之,如果您必须在 Wicket 和 JSF 之间做出决定,那么对我来说毫无疑问,Wicket

I started with JSF (1.1 and 1.2) and it was so painful that I decided to change in next projects. I researched a bit and I decided to try Wicket, and it was so a pleasure.
Also I've tried JSF 2 but is still the same thing.

Both of them are component frameworks, but things with Wicket are easy while with JSF are a complete mess.

Wicket over JSF:

  • In Wicket HTML are HTML. JSF has its own mark-up tags. The h:dataTable (for tables) is nonsense. Believe me, Sun Engineers had to be drunk when designed it.
  • In Wicket things like security,
  • With JSF the navigation bar shows the previous URL. Really odd.
  • JSF seems to me very heavy, and with libraries like Rich or Prime even more.
  • Sometimes, it seems impossible to know which is happening. You always end up yelling at your computer because you don't know why JSF is doing.

JSF over Wicket:

  • In Wicket you're going to write more Java (the binding with HTML). At least, your IDE will provide refactoring and validation support.
  • Resources management in Wicket is a bit tricky.
  • There are much more documentation and support for JSF

One common flaw is that session size is are problem (because graphical components are stored in there).

All in all, if you have to decide only between Wicket and JSF there not doubt for me, Wicket.

惯饮孤独 2024-07-23 09:09:13

JSF 已被弃用(2010 年传道者比较或谈论 Web 框架时,JSF 甚至没有被列为可比较的框架)。

现在,成熟的大型应用程序是使用 GWT、YUI、JQuery 等创建的。

阅读 google 及以上的一些文章就会很明显。

(JSF 上的所有作业都是为了支持遗留应用程序)。

JSF is deprecated (JSF is not even listed as a framework to compare when evangelists compare or talk about web frameworks in 2010).

Now full fledge large scale applications are created using GWT, YUI, JQuery etc.

Read some articles over google and above will be obvious.

(ALL JOBS on JSF are to support legacy applications).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文