aspose file tools*
The moose likes Servlets and the fly likes Package javax.servlet.jsp.tagext not found . Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Package javax.servlet.jsp.tagext not found ." Watch "Package javax.servlet.jsp.tagext not found ." New topic
Author

Package javax.servlet.jsp.tagext not found .

Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Hi all
I'm trying to run a simple custom tag .
i'm getting that error(Package javax.servlet.jsp.tagext not found in import )
i set my classpath as: d:\jakart-tomcat\src\servlet\jsp
what should i do to fix this problem.
inothere words is setting the classpath with this way right?
here is the java file:
package coreservlets.tags;
import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;
import java.io.*;
public class ExampleTag extends TagSupport
{
public int doStartTag()
{
try
{
JspWriter out=pageContext.getOut();
out.print("Custom tag example " );

}
catch(IOException ioe)
{
System.out.println("Error happened ");
}
return(SKIP_BODY);

}
}
Thanks alot.
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12769
    
    5
"i set my classpath as: d:\jakart-tomcat\src\servlet\jsp"
Why? Thats the path to the source code, provided as an aid to those who want to modify Tomcat. The compiled java classes for the javax.servlet.* etc are in
\jakarta-tomcat\lib\servlet.jar
Bill
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Thanks Bill
that was right,i compiled it and it is working now.
but would you please help me with this:
i do not know where do i have to put the tag library descriptor file?
i put under: d:\jakarta-tomcat\webapps\examples\jsp.
and is not working.please if you can tell me where do i have to put all files to get the custom atg run well.
here are all my files:
here is csajsp1-taglib.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-jsptaglibrary_1_1.dtd">
<!-- a tag library descriptor -->
<taglib>
<!-- after this the default space is
"http://java.sun.com/j2ee/dtds/jsptaglibrary_1_2.dtd"
-->
<tlibversion>1.0</tlibversion>
<jspversion>1.1</jspversion>
<shortname>csajsp1</shortname>
<uri></uri>
<info>
A simple tab library for the examples
</info>
<tag>
<name>example</name>
<tagclass>coreservlets.tags.ExampleTag</tagclass>
<info> Display JSP sources </info>

</tag>
<!-- A simple Tag -->

</taglib>
Here is the java file:
package coreservlets.tags;
import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;
import java.io.*;
public class ExampleTag extends TagSupport
{
public int doStartTag()
{
try
{
JspWriter out=pageContext.getOut();
out.print("Custom tag example " );
}
catch(IOException ioe)
{
System.out.println("Error happened ");
}
return(SKIP_BODY);
}
}
here is the jsp file(SimpleExample.jsp):
<HTML>
<HEAD>
<%@ taglib uri="csajsp1-taglib.tld" prefix="csajsp1" %>
<TITLE><csajsp1:example /></TITLE>
</HEAD>
<BODY>
<H1><csajs1p:example /></H1>
<csajsp1:example />
</BODY>
</HTML>
Thanks alot for your time.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Package javax.servlet.jsp.tagext not found .