Where to put my taglib declaration?
jsp, jstl
Solution
Usually right at the top of the file. If you start using multiple taglibs you could also move it to a separate include file to safe typing. For example
/WEB-INF/jspf/taglibs.jspf
<%@ page contentType="text/html;charset=utf8"%>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c"%>
/WEB-INF/jsp/index.jsp
<%@ include file="/WEB-INF/jspf/taglibs.jspf" %>
Problem
I've got a JSP and I'm going to start using the JSTL taglib. So I need to declare it and I do it by the row ``` <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> ``` But where do I put this code? At the top of the file, before everything, or after imports? Does it matter?