JSTL (JSP Standard Tag Library) 以標準化格式實現常用 Web 功能。核心標籤 c:import 擴展了 include 功能,支援更多協議與錯誤處理。
jakarta-taglibs-standard-current.tar.gz。c.tld 複製至 WEB-INF/tlds,JAR 檔至 WEB-INF/lib。web.xml 註冊:
<taglib>
<taglib-uri>https://java.sun.com/jstl/core</taglib-uri>
<taglib-location>/WEB-INF/tlds/c.tld</taglib-location>
</taglib>
<%@ taglib prefix="c" uri="https://java.sun.com/jstl/core" %>
<c:import url="header.jsp" />
後續將示範更多 JSTL 標籤替換 Scriptlet。