使用 taglib 有什么好处?
我将在 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您还可以使用模板引擎,例如 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.
标签库简单地等于遵守不要重复原则的代码重用。
Taglibs simply equals code re-use that complies with the Don't Repeat Yourself principle.
当您的视图逻辑太难或不可能使用 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 :)