|
|
|
![]() |
|
Strumenti |
![]() |
#1 |
Senior Member
Iscritto dal: Oct 2000
Città: Udine
Messaggi: 3178
|
taglib
EDIT: spiego un pò meglio...
Uso NetBeans IDE 4.1. questa è struttura delle directory e dei file: ![]() questo è il file test.jsp: Codice:
<%@page contentType="text/html"%> <%@page pageEncoding="UTF-8"%> <%@taglib uri="WEB-INF/tlds/mytags.tld" prefix="mytags"%> <html> <head> <title></title> </head> <body> <p><mytags:insert/></p> </body> </html> Codice:
<?xml version="1.0" encoding="UTF-8"?> <taglib version="2.0" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee web-jsptaglibrary_2_0.xsd"> <tlib-version>1.0</tlib-version> <short-name>mytags</short-name> <uri>/WEB-INF/tlds/mytags</uri> <tag> <name>insert</name> <tag-class>SimpleTag</tag-class> <body-content>empty</body-content> </tag> </taglib> questo è il sorvete di SimpleTag Codice:
import javax.servlet.jsp.tagext.*; import javax.servlet.jsp.JspWriter; import javax.servlet.jsp.JspException; public class SimpleTag extends SimpleTagSupport { public void doTag() throws JspException { JspWriter out=getJspContext().getOut(); try { out.println("funziono!"); } catch (java.io.IOException ex) { throw new JspException(ex.getMessage()); } } } org.apache.jasper.JasperException: Unable to compile class for JSP An error occurred at line: 9 in the jsp file: /test.jsp Generated servlet error: C:\Documents and Settings\Gremo\.netbeans\4.1\jakarta-tomcat-5.5.7_base\work\Catalina\localhost\TestSimpleTag\org\apache\jsp\test_jsp.java:78: cannot find symbol symbol : class SimpleTag location: class org.apache.jsp.test_jsp SimpleTag _jspx_th_mytags_insert_0 = new SimpleTag(); ^ Ultima modifica di Gremo : 28-09-2005 alle 22:01. |
![]() |
![]() |
![]() |
Strumenti | |
|
|
Tutti gli orari sono GMT +1. Ora sono le: 09:58.