spring 和 apache 具有共享 taglib 的图块
我正在创建基于 spring 和 apachetiles 的应用程序。我想在我的布局部分共享一个标签库。我已经在布局中添加了
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
现在我想在布局的各个部分中创建一个 foreach 循环,但我不能。当我在布局部分添加此标签库定义时,它起作用了。我可以仅在一处添加 taglib 还是需要将其添加到每个 jsp 文件中?
I´m creating spring and apache tiles baserd application. I want to share a taglib in my parts of layout. I`ve added in my layout
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
Now I want to create a foreach loop in the parts of layout but I can`t. When I added this taglib definition in the part of layout it worked. Can I add the taglib only n one place or I need to add it in every jsp file ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要为每个 jsp 文件添加 taglib。
因为tiles是在jsp文件编译后才起作用的,编译时需要taglib定义(编译器对tiles一无所知)。
You need to add the taglib for each jsp file.
Because tiles works after the jsp files are compiled, and the taglib definition is needed for compiling (the compiler does not know anything about tiles).