I am using the book "Web Development with JavaServer Pages" to develop a tag library for my company. I've created the TDL file describing the tag, and the Java tag handler class. I've got a page referencing the TDL, and then the page uses the tag defined in the TDL. But, I get the error: No such tag task the tag library imported with prefix sched where "task" is my tag name, and "sched" is the prefix. I've tried all mixes of capitalization, so I don't think it has to do with that. I am using Tomcat as my web server, running locally on a Win98 machine, and am running JDK 1.1.8_3. Has anyone experienced this problem before. If so, any solutions? I'm including my source below, in case that helps. Thanks! -David Castro [EMAIL PROTECTED] JSP file--------- <%@ taglib uri="/scheduling" prefix="sched" %> <HTML> <BODY> <sched:task name="Administrator" action="include"><p>This text is only displayed if the user is an administrator.</p></sched:task> </BODY> </HTML> web.xml file for this application---------- <?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN" "http://java.sun.com/j2ee/dtds/web-app_2.2.dtd"> <web-app> <taglib> <taglib-uri>/scheduling</taglib-uri> <taglib-location>/WEB-INF/tlds/sched.tld</taglib-location> </taglib> </web-app> sched.tld---------- <?xml version="1.0" encoding="ISO-8859-1" ?> <!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN" "http://java.sun.com/j2ee/dtds/web-jsptaglib_1_1.dtd"> <taglib> <tlibversion>1.0</tlibversion> <shortname>sched</shortname> <info>Utility tags for the online help for scheduling.com.</info> <tag> <name> task </name> <tagclass> taskTag </tagclass> <bodycontent> JSP </bodycontent> <info> Conditionalize content based on the tasks that the user performs </info> <attribute> <name> name </name> <required> true </required> </attribute> <attribute> <name> action </name> </attribute> </tag> </taglib> taskTag.java---------- import javax.servlet.http.HttpServletResponse; import javax.servlet.jsp.tagext.*; import javax.servlet.jsp.*; import java.io.IOException; public class TaskTag extends BodyTagSupport { private String task = "Scheduler"; private String action = "include"; public void setTask(String task) { this.task = task; } public String getTask() { return task; } public void setAction(String action) { this.action = action; } public String getAction() { return action; } public int doAfterBody() throws JspException { BodyContent body = getBodyContent(); String tagBody = body.getString(); body.clearBody(); try { // HttpServletResponse response = (HttpServletResponse)pageContext.getResponse(); //if the task attribute matches the tasks the user specified when logging in then display the body of the tag if (task.equalsIgnoreCase("Administrator")) { if (action.equalsIgnoreCase("include")) { //if tag requests an include for administrators... if (((Boolean)pageContext.getAttribute("Administrator")).booleanValue()) { //...and the user is an administrator, leave the body as is } else { tagBody = " "; //...and the user isn't an administrator, clear the body content } } else { //if tag requests an exclude for administrators... if (((Boolean)pageContext.getAttribute("Administrator")).booleanValue()) { tagBody = " "; //...and the user is an administrator, then clear the content } else { //...and the user is not an administrator, the leave the body as is } } } if (task.equalsIgnoreCase("Scheduler")) { if (action.equalsIgnoreCase("include")) { //if tag requests an include for schedulers... if (((Boolean)pageContext.getAttribute("Scheduler")).booleanValue()) { //...and the user is a scheduler, leave the body as is } else { tagBody = " "; //...and the user is not a scheduler, clear the content } } else { //if tag requests an exclude for schedulers... if (((Boolean)pageContext.getAttribute("Scheduler")).booleanValue()) { tagBody = " "; //...and the user is a scheduler, clear then content } else { //...and the user isn't a scheduler, leave the body as is } } } if (task.equalsIgnoreCase("Registrar")) { if (action.equalsIgnoreCase("include")) { //if tag requests an include for registrars... if (((Boolean)pageContext.getAttribute("Registrar")).booleanValue()) { //and the user is a registrar, leave the body as is } else { tagBody = " "; //...and the user is not a registrar, clear the content } } else { //if the tag requests an exclude for registrars... if (((Boolean)pageContext.getAttribute("Registrar")).booleanValue()) { tagBody = " "; //...and the user is a registrar, clear the content } else { //...and the user is not a registrar, leave the body as is } } } getPreviousOut().print(tagBody); } catch (IOException e) { throw new JspTagException("I/O exception " + e.getMessage()); } return SKIP_BODY; } public void release() { action = "include"; task = "Scheduler"; } } __________________________________________________ Do You Yahoo!? Send instant messages & get email alerts with Yahoo! Messenger. http://im.yahoo.com/ =========================================================================== To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". Some relevant FAQs on JSP/Servlets can be found at: http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.html http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
