I am using web-fragment feature to maintain my JSPs and tags in a jar, and using this approach, my JSP pages are unable to find the tagdir, and cause "The value of the tagdir attribute for this tag library is invalid."
Here is the structure in my jar.
META-INF
-- resources
-- WEB-INF
-- tags
-- mytag.tag
-- mypage.jsp
-- web-fragment.xml
In mypage.jsp, I specify the taglib as following:
And I got these errors:
mypage.jsp:7:4: The taglib directive must specify either the "uri" or "tagdir" attribute.
mypage.jsp:7:33: The value of the tagdir attribute for this tag library is invalid.
It seems like under this approach, it cannot find the tagdir. I tried the same structure in my war with web.xml, and it was able to find the tags. So I wonder if there is any way I can use the similar solution with web-fragment approach.
You don't need
WEB-INF
in the web-fragment project. Use this structure instead:web-fragment project:
Everything inside the
resources
directory will now be available to referencing projects as if they were deployed insideWEB-INF
.web project:
So to reference
mytag.tag
from the web project:As for the errors you are seeing, I don't know what you tried, but here's how you'd do it:
for a
.tag
you must specify tagdir and set it to the tag's folder:for a
.tld
you must specify uri and set it to the tld's URI: