Sarah Vessels
Sarah Vessels

Reputation: 31660

Spring MVC - unable to locate tag library for custom tag

I keep getting an "JSPG0047E: Unable to locate tag library for uri /WEB-INF/tags" error on the following JSP:

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@taglib prefix="my" tagdir="/WEB-INF/tags" %>
<my:custom-tag param1="${someVariable}" />

My tag looks like this:

<%@ tag body-content="empty"%>
<%@ attribute name="param1" required="true" type="java.lang.Object"%>
<dl>
    <dt>Name</dt>
    <dd>${param1.name}</dd>
</dl>

This is in a Spring MVC app I've deployed in a WAR in an EAR to WebSphere Application Server 7. I don't know if it's a problem with the context-root, because the tags directory isn't at localhost/WEB-INF/tags but rather localhost/myApp/WEB-INF/tags, I think. I have the following directory structure:

- src
    - main
        - webapp
            - WEB-INF
                - tags
                    - custom-tag.tag
                - views
                    - jspFileThatUsesTag.jsp

The deployment assembly for the WAR project has /src/main/webapp going to /, so WEB-INF/tags is getting put at the root of my app.

What am I doing wrong? Trying to put a different value for tagdir="/WEB-INF/tags" causes an error about the tag directory not starting with WEB-INF/tags.

Upvotes: 0

Views: 3654

Answers (1)

Sarah Vessels
Sarah Vessels

Reputation: 31660

...It works. I did a Project > Clean just on a lark, published again to the server from within Rational Application Developer, and now it has no problem with my tags directory or my custom tag.

Upvotes: 1

Related Questions