Java error: message Invalid tld file: see JSP 2.2 7.3.1 specification section for more details.

when I visit the local java tomcat page, the error is the following, please help check what is wrong with this, thanks

Jsp code

<%@ taglib prefix="p" uri="/WEB-INF/classes/tld/pagertag.tld"%> 

error log:

 SEVERE: Servlet.service() for servlet jsp threw exception org.apache.jasper.JasperException: Invalid tld file: "/WEB-INF/classes/tld/pagertag.tld", see JSP 2.2 specification section 7.3.1 for more details at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:56) at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:445) at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:117) at org.apache.jasper.compiler.TagLibraryInfoImpl.generateTLDLocation(TagLibraryInfoImpl.java:347) at org.apache.jasper.compiler.TagLibraryInfoImpl.<init>(TagLibraryInfoImpl.java:154) at org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:419) at org.apache.jasper.compiler.Parser.parseDirective(Parser.java:484) at org.apache.jasper.compiler.Parser.parseElements(Parser.java:1421) at org.apache.jasper.compiler.Parser.parse(Parser.java:138) at org.apache.jasper.compiler.ParserController.doParse(ParserController.java:242) at org.apache.jasper.compiler.ParserController.parse(ParserController.java:102) 
+7
java jsp
source share
3 answers

according to the documentation

Tag library descriptor files have names that use the .tld extension, and the extension indicates a tag library descriptor file. when deployed inside a JAR file, the tag library descriptor files must be in the META-INF directory or in its subdirectory. When deployed directly to a web application, tag library descriptor files should always be located in the WEB-INF directory or its subdirectory. TLD files should not be placed in / WEB-INF / classes or / WEB-INF / lib and should not be placed inside / WEB-INF / tags or a subdirectory , unless the name implicit.tld is specified , and is intended to configure an implicit tag library with its JSP version and tlib version.

you can put your lib tag inside WEB-INF / tags with renaming implicit.tld

+8
source share

In jsp-2_2

JSP.7.3.1 Identification of tag library descriptors Tag library descriptor files have names that use the .tld extension, and extension indicates the tag library descriptor file. When deploying inside a JAR file, the tag library descriptor files must be in the META-INF directory or in a subdirectory of this. When deploying a tag library descriptor directly in a web application, the files should always be in the WEB-INF directory or in some subdirectory. TLD files should not be placed in / WEB-INF / classes or / WEB-INF / lib and should not be placed inside / WEB-INF / tags or in its subdirectory unless the name implicit.tld is specified and intended for setting up the library of implicit tags with its JSP version and tlib version.

The .tld file cannot be in the class, lib, tag, or subfolder folders.

+7
source share

The problem seems to be related to the tomcat version. After changing the tomcat version from tomcat 8 to 7.0.55, it works fine.

0
source share

All Articles