3

I am working with Java EE 7 in Intellij IDEA and trying to create and use a custom .tag file. I have followed this answer and created a wrapper.tag file in WEB-INF/tags :

<%@tag description="Simple Wrapper Tag" pageEncoding="UTF-8"%>
<html><body>
  <jsp:doBody/>
</body></html>

And i have created a .jsp file in my web directory:

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib prefix="t" tagdir="/WEB-INF/tags" %>

<t:wrapper>
    <h1>Welcome</h1>
</t:wrapper>

But when loading the page I always one of two following errors:

  • No tag "wrapper" defined in tag library imported with prefix "t"
  • lang.ClassNotFoundException: org.apache.jsp.temptest_jsp

Note that my jsp file is called temptest.jsp. Thanks in advance

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
StarterPack
  • 498
  • 1
  • 7
  • 28

2 Answers2

2

Two things you need to check, I was also facing the same problem

  1. <%@ taglib tagdir="/WEB-INF/tags/" prefix="tag" %> add '/' after tags
  2. In the tagdir path there should be no spelling mistakes, I had forgot to add 's' to tags folder.
amarnath
  • 785
  • 3
  • 19
  • 23
0

I've also met this problem before. Turn out, my tags folder in out/artifacts/WEB-INF wasn't updated after I renamed the folder. You may want to check that.

I'm not good at Java. In fact, I'm a C# dev. My solution is to manually rename the folder. There must be a way that we can update these actions automatically that I haven't known. :)

The reference folder

Rogger Tân
  • 71
  • 2
  • 6