Apache Tapestry 和 Apache Wicket 之间的区别

发布于 2024-07-15 09:54:06 字数 675 浏览 7 评论 0 原文

Apache Wicket ( http://wicket.apache.org/ ) 和 Apache Tapestry ( https://tapestry.apache.org/都是面向组件的 Web 框架 - 与基于操作的框架,例如由 Apache 基金会开发的 Stripes。 两者都允许您从 Java 组件构建应用程序。 他们看起来都和我很相似

这两个框架有什么区别? 有人两者都有经验吗? 具体来说:

  • 它们的性能如何,状态处理可以定制多少,它们可以无状态使用吗?
  • 他们的组件模型有什么区别?
  • 您会为哪些应用选择什么?
  • 它们如何与 Guice、Spring、JSR 299 集成?

编辑:我已经阅读了两者的文档并且使用了两者。 通过阅读文档无法充分回答这些问题,但可以通过使用这些文档一段时间的经验来回答,例如如何在无状态模式下使用 Wicket 来实现高性能站点。 谢谢。

Apache Wicket ( http://wicket.apache.org/ ) and Apache Tapestry ( https://tapestry.apache.org/ ) are both component oriented web frameworks - contrary to action based frameworks like Stripes - by the Apache Foundation. Both allow you to build your application from components in Java. They both look very similar to me.

What are the differences between those two frameworks? Has someone experience in both? Specifically:

  • How is their performance, how much can state handling be customized, can they be used stateless?
  • What is the difference in their component model?
  • What would you choose for which applications?
  • How do they integrate with Guice, Spring, JSR 299?

Edit: I have read the documentation for both and I have used both. The questions cannot be answered sufficently from reading the documentation, but from the experience from using these for some time, e.g. how to use Wicket in a stateless mode for high performance sites. Thanks.

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

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

发布评论

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

评论(8

記柔刀 2024-07-22 09:54:06

我看到的一些相关差异:

  • Tapestry 使用半静态页面
    结构,您可以在其中使用
    条件和循环来实现
    动态行为。 检票口是
    完全动态; 你可以加载
    动态组件,替换它们
    在运行时等的后果
    这是 Tapestry 更容易做到的
    优化,Wicket 更
    使用灵活。
  • 两个框架
    大致相同效率
    执行,但 Wicket 依赖于
    服务器端存储(默认情况下
    会话中的当前页面和过去的页面
    “二级缓存”中的页面
    文件中默认是临时文件
    系统)。 如果这让你烦恼,想一想
    关于有多少并发会话
    您期望在高峰时间有
    计算一下,每个会话约 100kb
    (这可能偏高)。
    这意味着你可以大致运行
    支持 20k 并发会话
    2GB。 说 15k 因为你需要它
    对其他事物的记忆也是如此。 的
    当然,存储的缺点
    状态是它只会运作良好
    具有会话亲和力,所以这是
    使用 Wicket 时的限制。 这
    框架为你提供了一种手段
    实现无状态页面,但是如果
    你正在开发完全无状态的
    您可能会考虑的应用程序
    不同的框架。
  • Wicket 的目标是最大程度地支持静态类型,而 Tapestry 更多的是为了节省代码行。 因此,使用 Tapestry,您的代码库可能会更小,这有利于维护,而使用 Wicket,您的大部分代码都是静态类型的,这使得使用 IDE 导航和使用编译器检查变得更容易,这也有利于维护。 恕我直言,有话要说。

我已经读过几次,人们认为 Wicket 通过继承来工作。 我想强调的是,你有选择的权利。 组件具有层次结构,但 Wicket 还支持通过 IBehavior 等构造进行组合(例如,Wicket 的 Ajax 支持是在其之上构建的)。 最重要的是,您可以将转换器和验证器之类的东西添加到全局组件中,甚至可以使用 Wicket 提供的一些阶段侦听器作为横切关注点。

Some relevant differences as I see them:

  • Tapestry uses a semi-static page
    structure, where you can work with
    conditionals and loops to achieve
    dynamic behavior. Wicket is
    completely dynamic; you can load
    components dynamically, replace them
    at runtime, etc. The consequences of
    this are that Tapestry is easier to
    optimize, and that Wicket is more
    flexible in it's use.
  • Both frameworks
    are roughly equally efficient in
    execution, but Wicket relies on
    server side storage (by default the
    current page in session, and past
    pages in a 'second level cache' which
    is default a temp file in the file
    system). If that bothers you, think
    about how many concurrent sessions
    you expect to have at peak times and
    calculate with say ~100kb per session
    (which is probably on the high side).
    That means that you can run roughly
    support 20k concurrent sessions for
    2GB. Say 15k because you need that
    memory for other things as well. Of
    course, a disadvantage of storing
    state is that it'll only work well
    with session affinity, so that's a
    limitation when using Wicket. The
    framework provides you with a means
    to implement stateless pages, but if
    you're developing fully stateless
    applications you might consider a
    different framework.
  • Wicket's goal is to support static typing to the fullest extent, whereas Tapestry is more about saving lines of code. So with Tapestry your code base is likely smaller, which is good for maintenance, and with Wicket, you much is statically typed, which makes it easier to navigate with an IDE and check with a compiler, which also is good for maintenance. Something to say for both imho.

I have read a few times by now that people think Wicket works through inheritance a lot. I would like to stress that you have a choice. There is a hierarchy of components, but Wicket also supports composition though constructs like IBehavior (on top of which e.g. Wicket's Ajax support is built). On top of that you have things like converters and validators, which you add to components, globally, or even as a cross cutting concern using some of the phase listeners Wicket provides.

决绝 2024-07-22 09:54:06

在学习 Tapestry 5 之后修订

Wicket 的目标是尝试使Web 开发类似于桌面 GUI。 他们以消耗内存(HTTPSession)为代价成功地做到了这一点。

Tapestry 5 的目标是打造非常优化(针对 CPU 和内存)面向组件的 Web 框架。

对我来说真正的大陷阱是响应“Wicket 支持无状态组件!” 论点“Wicket 内存匮乏”。 虽然 Wicket 确实支持无状态组件,但它们并不是“Wicket 开发的重点”。 例如,StatelessForm 中的错误很长时间没有得到修复 - 请参阅 StatelessForm - 验证失败后参数出现问题

  • 恕我直言,在您要优化/微调 Web 应用程序参数之前,使用 Wicket 会更容易一些。恕我直言,
  • 如果您已经编写了 Web 应用程序并且想要考虑请求处理,那么 Wicket 会更难研究
  • Tapestry 5 自动重新加载组件类 一旦你改变它们。 两个框架都会重新加载组件标记。
  • Wicket 强制标记/代码分离,Tapestry 5 恰好为您提供了这种能力。 您还可以在 Tapestry 5 中使用不太详细的语法。与往常一样,这种自由需要更加谨慎。
  • Wicket 的核心更容易调试:用户组件基于继承,而 Tapestry 5 用户组件基于注释。 从另一方面来看,这可以使 Tapestry 比 Wicket 更容易过渡到未来版本。

不幸的是 Tapestry 5 教程 并没有强调像 't:loop source 这样的 Tapestry 代码示例="1..10"...' 可能是一个不好的做法。 因此,如果您的团队不是很小,应该花一些精力来编写 Tapestry 使用约定/良好实践。

我的建议

  • 当您的页面结构非常动态并且您可以负担每个用户 10-200 Kbs 的 HttpSession 内存(这些是粗略数字)时,请使用 Wicket。
  • 当您需要更有效地利用资源时,请使用 Tapestry 5

REVISED after studying Tapestry 5.

Wicket's goal is an attempt to make web development similar to desktop GUI one. They managed to do it really well at the expense of memory usage ( HTTPSession ).

Tapestry 5's goal is to make very optimized (for CPU and memory) component oriented web framework.

The really big pitfall for me was responses "Wicket supports stateless component!" to the arguments "Wicket is memory hungry". While Wicket indeed supports stateless components they are not "a focus of Wicket development". For example a bug in StatelessForm was not fixed for a very long time - see StatelessForm - problem with parameters after validation fails.

  • IMHO using Wicket is a bit eaiser until you are going to optimize/ fine-tune web application parameters
  • IMHO Wicket is harder to study if you have programmed web applications and want to think in terms of request processing
  • Tapestry 5 automatically reloads component classes as soon as you change them. Both frameworks reload component markup.
  • Wicket forces markup/ code separation, Tapestry 5 just give you this ability. You can also use less verbose syntax in Tapestry 5. As always this freedom requires more cautions to be taken.
  • Wicket's core is easier to debug: user components are based on inheritance while Tapestry 5 user components are based on annotations. From the other side that could make transitions to the future versions easier for Tapestry then for Wicket.

Unfortunately Tapestry 5 tutorial does not stress that Tapestry code example like 't:loop source="1..10"...' can be a bad practice. So some effort should be put into writing Tapestry usage conventions/ good practices if your team is not very small.

My recommendations:

  • Use Wicket when your pages structure is very dynamic and you can afford spending 10-200 Kbs of HttpSession memory per user (these are rough numbers).
  • Use Tapestry 5 in cases when you need more efficient usage of resources
做个ˇ局外人 2024-07-22 09:54:06

我认为 Wicket 是一个使用起来更简单的框架。

此外,Wicket 确实允许通过 IDE 的热代码替换系统重新加载类。 这就是 Wicket 运行当前正在运行的应用程序类的修改版本所需的全部内容。 通常的限制适用于热代码替换,例如必须在调试模式(Eclipse)下运行并且无法更改类的结构方面(即类名、更改方法签名等...)。

I think Wicket is a simpler framework to use.

Also, Wicket does allow for class reloading via your IDE's hot-code replace system. This is all that is required for Wicket to run off modified versions of a currently running application's classes. The usual restrictions apply for hot-code replace, such as having to run in Debug mode (Eclipse) and not being able to change structural aspects of a class (i.e. class name, changing method signatures etc...).

凑诗 2024-07-22 09:54:06

Wicket 是非常好的Web 框架。 据我所知最好的。 我从 1.3 版本开始就使用它,并且总是能得到我想要的。
Wicket 与 Spring 具有出色的集成 - 只需在代码中使用 @SpringBean 注释即可将任何 spring bean 注入到您的类中。

Wicket is very good web framework. Best from all what i'm know. I'm use it since version 1.3 and always get what i'm want.
Wicket has excellent integration with Spring - just use @SpringBean annotation in you code to inject any spring bean to your classes.

微暖i 2024-07-22 09:54:06

尝试 http://incubator.apache.org/click/
这是一个令人惊叹的 Java Web 框架。
有些人称之为“检票正确”;-)

Try http://incubator.apache.org/click/ .
It is amazing java web framework.
Some people call it “Wicket made right” ;-)

邮友 2024-07-22 09:54:06

我不喜欢 Tapestry 编程模型,并且我知道许多开发人员因为开发中的太多变化和不兼容性而离开 Tapestry。 请参阅:http://ptrthomas.wordpress .com/2009/09/14/perfbench-update-tapestry-5-and-grails/

I don't like the Tapestry programming model and I know of many developers leaving Tapestry because of too much changes and incompatibilities in development. See: http://ptrthomas.wordpress.com/2009/09/14/perfbench-update-tapestry-5-and-grails/

她说她爱他 2024-07-22 09:54:06

正如我在 4.1 正式稳定版本发布时所说的那样:

在承诺使用 Tapestry 之前,您应该仔细研究一下 Tapestry 的开发历史。 Tapestry 做了很多不兼容的升级,没有继续支持旧版本。 在合理的时间内不再处理 4.1 的补丁。 在我看来,这对于官方稳定版本来说是不可接受的。

承诺使用 Tapestry 5 意味着:

您应该成为一名提交者;
你需要跟上所有新的发展,尽快放弃旧版本;
自己维护稳定版本。

As I said when 4.1 was the official stable release:

You should take a very good look at the development history of Tapestry before committing to use it. Tapestry has done a lot of non-compatible upgrades, with no continuation of support of older versions. Patches to 4.1 are not processed anymore within a reasonable timeframe. That is in my point of view not acceptable for the official stable version.

Committing to use Tapestry 5 means:

you should become a committer;
you need to keep up with all new development, abandon old versions as fast as possible;
maintain stable versions yourself.

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