1、在WEB-INF中新建一个lib目录,导入 jstl 标签库的 jar 包
下载链接: JSTL压缩包. 在解压后的lib目录中找到 jstl.jar standard.jar 然后将这两个文件复制到lib目录下。 然后右击选择如图(两个都要这样做,目的是添加到工程目录):  然后点击OK即可 
2.在WEB-INF下新建一个tlb目录,导入需要的tlb文件
tlb文件在解压后的tlb文件夹下,将 tld 文件夹中的文件复制tlb目录下。 完成后如图: 
3.在web.xml中的配置文件信息
配置信息如下:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"
version="4.0">
<jsp-config>
<taglib>
<taglib-uri>http:
<taglib-location>/WEB-INF/tld/fmt.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>http:
<taglib-location>/WEB-INF/tld/fmt-1_0.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>http:
<taglib-location>/WEB-INF/tld/c.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>http:
<taglib-location>/WEB-INF/tld/c-1_0.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>http:
<taglib-location>/WEB-INF/tld/sql.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>http:
<taglib-location>/WEB-INF/tld/sql-1_0.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>http:
<taglib-location>/WEB-INF/tld/x.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>http:
<taglib-location>/WEB-INF/tld/x-1_0.tld</taglib-location>
</taglib>
</jsp-config>
</web-app>
4、在需要使用标签库的jsp页面,使用 taglib 指令引入标签库。
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
完成!
总结
亲测有效,希望能帮助到大家
参考:
https://www.runoob.com/jsp/jsp-jstl.html
|