Salve,
Ho problemi con questo semplice esempio di Tag JSP personalizzato.
Si tratta di un semplice Hello World a cui viene passato un nome utente. Ecco i files:
1) La pagina JSP
Codice PHP:
...
<%@ taglib uri="WEB-INF/helloTag.tld" prefix="ct" %>
...
<ct:hello name="Matteo"/>
...
2) Il file TLD
Codice PHP:
...
<taglib>
<tlibversion>1.0</tlibversion>
<jspversion>1.1</jspversion>
<shortname>helloTag</shortname>
<tag>
<name>hello</name>
<tagclass>HelloTag</tagclass>
<bodycontent>empty</bodycontent>
<attribute>
<name>name</name>
<required>true</required>
</attribute>
</tag>
</taglib>
3) La classe Handler java:
Codice PHP:
public class HelloTag extends BodyTagSupport {
private String name;
// Metodi setter e getter
public int doStartTag() throws JspException {
try {
JspWriter out = pageContext.getOut();
out.println("Ciao " +name);
} catch (IOException e) {
throw new JspTagException("I/O Exception");
}
return SKIP_BODY;
}
}
L'errore riportatomi è:
org.apache.jasper.JasperException: Unable to compile class for JSP:
An error occurred at line: 11 in the jsp file: /index.jsp
HelloTag cannot be resolved to a type
8: <title>Custom Tag</title>
9: </head>
10: <body>
11: <ct:hello name="Matteo"/>
12: </body>
13: </html>
Qualche suggerimento?
Grazie dell'attenzione,
Matteo.