Donc, je réalise un tag personnalisé version 2.0 sous eclipse Helios mais Tomcat m'a indiqué qu'il y a des erreurs or je pense que tout est bien installés (*.tld, classe Handler.....)
Voici l'erreur :
org.apache.jasper.JasperException: Impossible de compiler la classe pour la JSP:

Une erreur s'est produite à la ligne: 11 dans le fichier jsp: /index.jsp
HelloTag cannot be resolved to a type
8: <title>Tag Lib Introduction</title>
9: </head>
10: <body>
11: <tague:tage/>
12: </body>
13: </html>


Une erreur s'est produite à la ligne: 11 dans le fichier jsp: /index.jsp
HelloTag cannot be resolved to a type
8: <title>Tag Lib Introduction</title>
9: </head>
10: <body>
11: <tague:tage/>
12: </body>
13: </html>


Stacktrace:
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:92)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:439)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:349)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:327)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:314)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:589)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
Et voici la classe Handler :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
 
import java.io.IOException;
 
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.SimpleTagSupport;
 
public class HelloTag extends SimpleTagSupport 
{
    public void doTag() throws JspException, IOException 
    {
         getJspContext().getOut().println("Hello World !");
    }
}
Et le code index.jsp
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
 
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<%@ taglib uri="/WEB-INF/tld/montaglib.tld"  prefix = "tague"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Tag Lib Introduction</title>
</head>
<body>
      <tague:tage/>
</body>
</html>