使用 taglib 有什么好处?

发布于 2024-11-15 22:28:24 字数 112 浏览 5 评论 0原文

我将在 Netbeans 上使用 Spring Web MVC 框架。编写 Web 用户界面时我真的需要使用 taglib 还是可以使用 XHTML 实现相同的功能?使用 taglib 有什么好的理由吗? 此致

I am going to use Spring Web MVC Framework on Netbeans. Writing Web user interface do I really need to use taglib or can I aim the same functionality with XHTML? Is there any good reason for using taglib?
Best regards

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

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

发布评论

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

评论(3

画▽骨i 2024-11-22 22:28:24

您还可以使用模板引擎,例如 FreeMarker速度。如果您不想走 JSP 路线。尽管 Spring 标签也相当不错。

You could also use a templating engine like FreeMarker or Velocity. If you wish to not go down a JSP route. Although the Spring tags are pretty good as well.

回忆那么伤 2024-11-22 22:28:24

标签库简单地等于遵守不要重复原则的代码重用。

Taglibs simply equals code re-use that complies with the Don't Repeat Yourself principle.

回梦 2024-11-22 22:28:24

当您的视图逻辑太难或不可能使用 JSTL 进行编码,并且您不想使用 scriptlet(嵌入在页面中的 Java)时,请使用 taglib。不幸的是,编写标签库相当复杂,因此实际上只有在真正需要时才这样做。

哦,是的,当然还有干:)

Use a taglib when you have view logic that would be too difficult or impossible to code using JSTL, and you don't want to use scriptlets (Java embedded in the page). Unfortunately writing a taglib is fairly complex so in practice it's only done when really needed.

Oh yeah, and of course DRY :)

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