带有共享taglib的spring和apache tile [英] spring and apache tiles with shared taglib

查看:102
本文介绍了带有共享taglib的spring和apache tile的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建spring和apache tile baserd应用程序。我想在布局的各个部分共享一个taglib。我已经在布局中添加了

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" %>

现在我想在布局的各个部分中创建一个foreach循环,但是我不能。当我在布局的一部分中添加此taglib定义时,它起作用了。我可以只在一个位置添加taglib吗,还是需要在每个jsp文件中添加它?

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 ?

推荐答案

您需要添加每个jsp文件的taglib。

You need to add the taglib for each jsp file.

因为tile在jsp文件被编译之后才起作用,并且需要taglib定义才能进行编译(编译器对tile一无所知)。

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).

这篇关于带有共享taglib的spring和apache tile的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆