spring and apache tiles with shared taglib

2019-07-19 07:51发布

问题:

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 ?

回答1:

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