jsp tags - Invalid tagdir attribute while web-fragment is used -


i using web-fragment feature maintain jsps , tags in jar, , using approach, jsp pages unable find tagdir, , cause "the value of tagdir attribute tag library invalid."

here structure in jar.

meta-inf
-- resources
    -- web-inf
        -- tags
            -- mytag.tag
    -- mypage.jsp
-- web-fragment.xml

in mypage.jsp, specify taglib following:

and got these errors:
mypage.jsp:7:4: taglib directive must specify either "uri" or "tagdir" attribute.

mypage.jsp:7:33: value of tagdir attribute tag library invalid.

it seems under approach, cannot find tagdir. tried same structure in war web.xml, , able find tags. wonder if there way can use similar solution web-fragment approach.

you don't need web-inf in web-fragment project. use structure instead:

web-fragment project:

meta-inf/ -- resources/    -- tags/       -- mytag.tag    -- mypage.jsp -- web-fragment.xml 

everything inside resources directory available referencing projects if deployed inside web-inf.

web project:

web-inf/ -- tags/    -- othertag.tag    -- (mytag.tag) -- otherpage.jsp -- (mypage.jsp) 

so reference mytag.tag web project:

<%@ taglib prefix="my" tagdir="/web-inf/tags" %> ... <my:mytag ... /> 

as errors seeing, don't know tried, here's how you'd it:

for .tag must specify tagdir , set tag's folder:

<%@ taglib prefix="my" tagdir="/web-inf/tags" %> 

for .tld must specify uri , set tld's uri:

<%@ taglib prefix="mytld" uri="http://example.com/tld/my" %> 

Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

.htaccess - Matching full URL in RewriteCond -