Java – correct TLD file header
•
Java
I wanted to create a custom tag, but I got "XML parsing error" on the JSP version line I checked my JSP version and it was exactly 2.1 I think the link is wrong
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE taglib PUBLIC "-//Sun Microsystems,Inc.//DTD JSP Tag Library 1.2//EN"
"http://java.sun.com/j2ee/dtd/web-jsptaglibrary_1_2.dtd">
<tlib-version>1.0</tlib-version>
<jsp-version>2.1</jsp-version>
Who can help me? thank you
UPD / ERROR MESSAGE:org. apache. jasper. Jasperexception: unable to initialize tldlocationscache: org apache. jasper. Jasperexception: file / WEB-INF / TLDs / tag XML parsing error on TLD: (line 11, column 2)
Solution
You are using the DTD style declared by the old JSP 1.2 tag library You need to delete it (and < JSP version >) and use the new JSP 2.1 XSD declaration:
<?xml version="1.0" encoding="UTF-8" ?>
<taglib
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee/web-jsptaglibrary_2_1.xsd"
version="2.1">
<!-- Taglib config here -->
</taglib>
Make sure you are reading the correct books / tutorials for JSP 2.1, not JSP 1.2
You can also see:
>Java EE 5 tutorial – tag library descriptors
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码
