web-app_4_0.xsd
使用SimpleTag 自定义Tag后 jsp 引用时报错
<%@taglib prefix="f" uri="https://openhome.cc/jsp/jstl/fake" %>
报错信息:
无法在web.xml或使用此应用程序部署的jar文件中解析绝对uri
.tld文件是放在项目WEB-INF文件夹下的
此时在web.xml中配置taglib
<jsp-config>
<taglib>
<taglib-uri>https://openhome.cc/jsp/jstl/fake</taglib-uri>
<taglib-location>/WEB-INF/f.tld</taglib-location>
</taglib>
<jsp-property-group>
<url-pattern>*.jsp</url-pattern>
<page-encoding>UTF-8</page-encoding>
<default-content-type>text/html</default-content-type>
</jsp-property-group>
</jsp-config>
*注意taglib标签的顺序在jsp-property-group标签前面
也可以将所用的tag打包成jar,
文件结构如下:
*注意tld文件名取成了固定的taglib.tld
此时在web.xml中配置taglib
<jsp-config>
<taglib>
<taglib-uri>https://openhome.cc/jsp/jstl/fake</taglib-uri>
<taglib-location>/WEB-INF/lib/fake.jar</taglib-location>
</taglib>
<jsp-property-group>
<url-pattern>*.jsp</url-pattern>
<page-encoding>UTF-8</page-encoding>
<default-content-type>text/html</default-content-type>
</jsp-property-group>
</jsp-config>
*注意taglib标签的顺序在jsp-property-group标签前面