All of my JSPs have this at the top:
<%@ page language="java" isELIgnored="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>
<%@ taglib tagdir="/WEB-INF/tags" prefix="tag" %>
Besides being repetitive, I have had a few hard-to-find bugs because of occasional inconsistencies. For example, a few of my JSP files were missing, isELIgnored="false"
, causing untold havoc.
Is there any way to put these imports into a file and then import that file in each JSP, rather than listing all of these imports in each file?
Yes, I always use an include.jsp such as:
and then reference that in the page using the import statement: