在jsp頁面引入了自定義的TLD文件的時候,碰到了一個錯誤html
Invalid tld file: "/WEB-INF/tags/xxxt.tld", see JSP 2.2 specification section 7.3.1 for more detailsweb
不符合 JSP2.2 中對tags的規定。
規定說的是這個:apache
In the jsp-2_2 JSP.7.3.1 Identifying Tag Library Descriptors Tag library descriptor files have names that use the extension .tld, 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 a subdirectory of it. When deployed directly into a web application, the tag library descriptor files must always be in the WEB-INF directory, or some subdirectory of it. TLD files should not be placed in /WEB-INF/classes or /WEB-INF/lib, and must not be placed inside /WEB-INF/tags or a subdirectory of it, unless named implicit.tld and intended to configure an implicit tag library with its JSP version and tlib-version. the .tld file can't be in classes , lib ,tags folder or subfolder.
意思是說,若是你使用的是jsp2.2就不能把tld文件放在 /WEB-INF/tags 以及其子目錄下。
jsp版本和tomcat的版本是相關的。jsp版本和tomcat的版本對應關係以下:tomcat
Servlet Spec | JSP Spec | EL Spec | WebSocket Spec | JASPIC Spec | Apache Tomcat Version | Latest Released Version | Supported Java Versions |
---|---|---|---|---|---|---|---|
4.0 | 2.3 | 3.0 | 1.1 | 1.1 | 9.0.x | 9.0.1 (beta) | 8 and later |
3.1 | 2.3 | 3.0 | 1.1 | 1.1 | 8.5.x | 8.5.23 | 7 and later |
3.1 | 2.3 | 3.0 | 1.1 | N/A | 8.0.x (superseded) | 8.0.47 (superseded) | 7 and later |
3.0 | 2.2 | 2.2 | 1.1 | N/A | 7.0.x | 7.0.82 | 6 and later(7 and later for WebSocket) |
2.5 | 2.1 | 2.1 | N/A | N/A | 6.0.x (archived) | 6.0.53 (archived) | 5 and later |
2.4 | 2.0 | N/A | N/A | N/A | 5.5.x (archived) | 5.5.36 (archived) | 1.4 and later |
2.3 | 1.2 | N/A | N/A | N/A | 4.1.x (archived) | 4.1.40 (archived) | 1.3 and later |
2.2 | 1.1 | N/A | N/A | N/A | 3.3.x (archived) | 3.3.2 (archived) | 1.1 and later |
詳情可查看:http://tomcat.apache.org/whichversion.htmlapp
1.若是你的tld文件放在 /WEB-INF/tags目錄下,而你不想改代碼,那麼,把tomcat換成apache-tomcat-7.0.55 或者如下的版本。(親測可行)
2.若是你不想換tomcat就把 tld放在 /WEB-INF下。less