[TAGLIB] No such tag XXX the tag library imported with prefix XXX

2000-05-22 Thread David Castro

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" %>



This text is only
displayed if the user is an administrator.




web.xml file for this application--

http://java.sun.com/j2ee/dtds/web-app_2.2.dtd">

  
/scheduling
/WEB-INF/tlds/sched.tld
  


sched.tld--

http://java.sun.com/j2ee/dtds/web-jsptaglib_1_1.dtd">


  1.0
  sched
  Utility tags for the online help for scheduling.com.

  

  task


  taskTag


  JSP


  Conditionalize content based on the tasks that the user performs


  

  name


  true

  

  

  action

  
  



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";
  }

}


Re: [TAGLIB] No such tag XXX the tag library imported with prefix XXX

2000-05-22 Thread yi lin

from my exp,I think you should check the the location of your taglib class
file.for tomcat I think you just put it in classes dir and check your
web.xml,make it correct.


>From: David Castro <[EMAIL PROTECTED]>
>Reply-To: A mailing list about Java Server Pages specification and
> reference <[EMAIL PROTECTED]>
>To: [EMAIL PROTECTED]
>Subject: [TAGLIB] No such tag XXX the tag library imported with prefix XXX
>Date: Mon, 22 May 2000 11:43:56 -0700
>
>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" %>
>
>
>
>This text is only
>displayed if the user is an administrator.
>
>
>
>
>web.xml file for this application--
>
>PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
>"http://java.sun.com/j2ee/dtds/web-app_2.2.dtd">
>
>   
> /scheduling
> /WEB-INF/tlds/sched.tld
>   
>
>
>sched.tld--
>
>"-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN"
>"http://java.sun.com/j2ee/dtds/web-jsptaglib_1_1.dtd">
>
>
>   1.0
>   sched
>   Utility tags for the online help for scheduling.com.
>
>   
> 
>   task
> 
> 
>   taskTag
> 
> 
>   JSP
> 
> 
>   Conditionalize content based on the tasks that the user performs
> 
>
>   
> 
>   name
> 
> 
>   true
> 
>   
>
>   
> 
>   action
> 
>   
>   
>
>
>
>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())
>{
&g

Re: [TAGLIB] No such tag XXX the tag library imported with prefix XXX

2000-05-23 Thread David Castro

Thanks for the response. The culprit ended up being the text that I was copying
from to create my TDL file. It was pointing to an invalid DTD address.

-David Castro
 [EMAIL PROTECTED]

--- yi lin <[EMAIL PROTECTED]> wrote:
> from my exp,I think you should check the the location of your taglib class
> file.for tomcat I think you just put it in classes dir and check your
> web.xml,make it correct.
>
>
> >From: David Castro <[EMAIL PROTECTED]>
> >Reply-To: A mailing list about Java Server Pages specification and
> > reference <[EMAIL PROTECTED]>
> >To: [EMAIL PROTECTED]
> >Subject: [TAGLIB] No such tag XXX the tag library imported with prefix XXX
> >Date: Mon, 22 May 2000 11:43:56 -0700
> >
> >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" %>
> >
> >
> >
> >This text is only
> >displayed if the user is an administrator.
> >
> >
> >
> >
> >web.xml file for this application--
> >
> > >PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
> >"http://java.sun.com/j2ee/dtds/web-app_2.2.dtd">
> >
> >   
> > /scheduling
> > /WEB-INF/tlds/sched.tld
> >   
> >
> >
> >sched.tld--
> >
> > >"-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN"
> >"http://java.sun.com/j2ee/dtds/web-jsptaglib_1_1.dtd">
> >
> >
> >   1.0
> >   sched
> >   Utility tags for the online help for scheduling.com.
> >
> >   
> > 
> >   task
> > 
> > 
> >   taskTag
> > 
> > 
> >   JSP
> > 
> > 
> >   Conditionalize content based on the tasks that the user performs
> > 
> >
> >   
> > 
> >   name
> > 
> > 
> >   true
> > 
> >   
> >
> >   
> > 
> >   action
> > 
> >   
> >   
> >
> >
> >
> >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