Apache Tiles 类似框架,但没有 xml 配置

发布于 2024-10-15 02:33:36 字数 229 浏览 1 评论 0原文

Apache Tiles 框架很棒。但我讨厌的一件事是我必须维护大型 xml 配置文件,即使已分区,我只是讨厌将编程和表示信息放在配置文件中。

我只是不明白? struts/tiles 作者是如何产生这种将如此多的表示逻辑放入配置文件中的强迫倾向的?

我正在寻找像 Tiles 这样的框架,但没有该死的 XML 配置。任何人都可以帮助列出基于与 Tiles 竞争的 Composite View 模型的布局框架。

Apache Tiles framework is great. But one thing I hate about it is the large xml configuration file that I have to maintain, even if partitioned, I just hate placing programmatic and presentation information inside configuration files.

I just don't get it? How did struts/tiles authors reach this obsessive tendency to place so much presentation logic inside configuration files?

I'm searching for a framework like Tiles but without the bloody XML configuration. Anyone can help in listing layout frameworks based on the Composite View model that compete with Tiles.

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

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

发布评论

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

评论(5

哽咽笑 2024-10-22 02:33:36

网站网。 Sitemesh 是一个类似的模板页面系统,但无需 xml 即可完成。如果您有一个或两个反复使用的主模板,则这尤其好,无需为每个模板创建 xml 条目。它目前是 Grails 中的默认模板系统。 Sitemesh 3 有一些不错的补充,但截至撰写本文时仍处于测试阶段,文档几乎为零。它使用装饰器模式,如所有tiles与sitemesh的比较中所示。


或者,如果您愿意放弃 jsp,您可以尝试 JSF 2.0,它具有非常令人印象深刻的模板功能,并且不需要 xml。与服务器端代码的 JSF 组件模型一起肯定有助于减少重复代码。 (作为奖励,JSF 2.0 的 Primefaces 组件库是最令人印象深刻的组件/小部件集之一。)

Sitemesh. Sitemesh is a similar system for templating pages but can be done without xml. This is especially nice if you have one or two main templates that you keep using over and over, no need to create an xml entry for each and every one. It's currently the default templating system in Grails. Sitemesh 3 has some nice additions but as of the time of this writing is stuck in beta with almost zero documentation. It uses the decorator pattern as seen in all of the comparison of tiles vs sitemesh.


Alternatively if you are willing to give up on jsp, you can give a go at JSF 2.0 which has very impressive templating capabilities with no xml needed. That along with the JSF component model for server side code will certainly assist in cutting down repetitive code. (As a bonus the Primefaces component library for JSF 2.0 is one of the most impressive component/widget sets around.)

挽手叙旧 2024-10-22 02:33:36

您是否考虑过 Apache Wicket

通过适当的标记/逻辑分离、POJO 数据模型以及令人耳目一新的 XML 缺失,Apache Wicket 使 Web 应用程序开发再次变得简单而愉快。将样板文件、复杂的调试和脆弱的代码替换为使用纯 Java 和 HTML 编写的强大、可重用的组件。

Have you considered Apache Wicket?

With proper mark-up/logic separation, a POJO data model, and a refreshing lack of XML, Apache Wicket makes developing web-apps simple and enjoyable again. Swap the boilerplate, complex debugging and brittle code for powerful, reusable components written with plain Java and HTML.

自在安然 2024-10-22 02:33:36

stripes 提供的布局标签非常棒。完全不需要配置并且易于理解和开始使用。它们在某种程度上是如此伟大,以至于我认为它们应该从 stripes 中提取出来,并作为一个单独的项目在自己的 github 项目空间上进行维护。

The layout tags provided by stripes are excellent. Require no configuration at all and easy to comprehend and start using. They are so great to an extent that I think they should be extracted from stripes and maintained as a separate project on there own github project space.

庆幸我还是我 2024-10-22 02:33:36

您可以在 这篇文章

这个想法是用您自己的 TilesDefinitionsConfig 实现 DefinitionsFactory 并调用 tilesConfigurer.setDefinitionsFactoryClass(TilesDefinitionsConfig.class);。您的新配置包含布局定义。

You can see a Tiles example with Java config (no XML) in this SO post.

The idea is to implement the DefinitionsFactory with a TilesDefinitionsConfig of your own and call tilesConfigurer.setDefinitionsFactoryClass(TilesDefinitionsConfig.class);. Your new config contains the layout definitions.

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