My project in eclipse -
I get the error below when I run MyTagUser.jsp - HTTP Status 500 - /jsp/MyTagUser.jsp(14,0) Attribute subTitle invalid for tag Header according to TLD
org.apache.jasper.JasperException: /jsp/MyTagUser.jsp(14,0) Attribute subTitle
invalid for tag Header according to TLD
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40)
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)...etc.
Snippet from Header.jsp -
<body>
<img src="../images/java_logo.gif"><br>
<em><strong> ${subTitle} </strong></em> <br>
</body>
Snippet from MyTagUser.jsp -
<%@ taglib prefix="myTags" tagdir="/WEB-INF/tags"%>
<html>
<head>
</head>
<body>
<myTags:Header subTitle="Java is the best !!!" />
JSP and Servlets.
</body>
</html>
You must use the attribute directive in your Header.tag file as show below -
<body>
<%@ attribute name="subTitle" required="true" rtexprvalue="true" %>
<img src="../images/java_logo.gif"><br>
<em><strong> ${subTitle} </strong></em> <br>
</body>