项目迁移,tomcat 从7升级到9,项目复制过去运行时自定义标签引用报错
org.apache.jasper.JasperException: Unable to find taglib [my] for URI: [/page/public/tags/custag.tdl]
需要在web.xml中再配置一下jsp-config 标签路由,并指向本地地址才能引用
jsp中引用
<%@ taglib prefix="my" uri="/page/public/tags/customTag.tld"%>
<!-- 原配置 -->
<jsp-config>
<jsp-property-group>
<url-pattern>*.jsp</url-pattern>
</jsp-property-group>
</jsp-config>
<!-- 修改后 -->
<jsp-config>
<jsp-property-group>
<url-pattern>*.jsp</url-pattern>
</jsp-property-group>
<!-- 新增 -->
<taglib>
<!-- 随便写,jsp中引用时使用的地址 -->
<taglib-uri>/page/public/tags/customTag.tld</taglib-uri>
<!-- 本地配置文件地址 -->
<taglib-location>/page/public/tags/customTag.tld</taglib-location>
</taglib>
</jsp-config>