This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JSP and the fly likes SimpleTagSupport  compile error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "SimpleTagSupport  compile error" Watch "SimpleTagSupport  compile error" New topic
Author

SimpleTagSupport compile error

Paul Thorp
Greenhorn

Joined: Sep 12, 2006
Posts: 6
I am trying to create some tag habdler examples to cement my learning process. I am getting compile errors indicating that the SimpleTagSupport class cannot be found.

It is also indicating that the package javax.servlet.jsp is not found. I obviously have something wrong with either the version or the installation of java.

Any ideas???
graham king
Ranch Hand

Joined: Dec 30, 2004
Posts: 133
looks like your classpath isn't set. you should check out how to compile/make your code with ant. it's really HELPS the building process.

i believe it's an apache product. www.apache.org


write, revise, re-write, revise, again...<br />write, revise, re-write, revise, again...
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60812
    
  65

Originally posted by Paul Thorp:

Any ideas???


Your post is markedly short on details which makes it hard to help you.

Taking a leap, I'll assume you are using Tomcat. Did you make sure that both the Servlet API and JSP API jars are added to your classpath? As of Tomcat 5, they are in separate jars.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Paul Thorp
Greenhorn

Joined: Sep 12, 2006
Posts: 6
Thanks. Here is some more info.

*********************************************************************************
*********** Here is a copy of the MS-DOS console displaying the compile errors.

Microsoft Windows 2000 [Version 5.00.2195]
(C) Copyright 1985-2000 Microsoft Corp.

C:\WINNT\system32>cd c:\

C:\>cd !Java Apps\TagSample

C:\!Java Apps\TagSample>javac src\com\example\misc\TagHandlerClass1.java -d cla
sses -classpath c:\aaaTomcat\common\lib\servlet-api.jar;c:\aaaTomcat\common\lib
\jsp-api.jar;c:\TagSample\classes\com\example\misc;./classes
src\com\example\misc\TagHandlerClass1.java:13: cannot find symbol
symbol: class SimpleTagSupport
public class TagHandlerClass1 extends SimpleTagSupport {
^
src\com\example\misc\TagHandlerClass1.java:16: cannot find symbol
symbol : class JspException
location: class com.example.misc.TagHandlerClass1
throws JspException, IOException {
^
src\com\example\misc\TagHandlerClass1.java:20: cannot find symbol
symbol : method getJspContext()
location: class com.example.misc.TagHandlerClass1
getJspContext().getOut().print("Outpit from Simple Tag Handler")
;
^
3 errors

C:\!Java Apps\TagSample>


****************************************************************************************
************* Here are my system level variables

Path - C:\bat;C:\Program Files\IBM\WebSphere MQ\Java\lib;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program Files\SQLLIB\help\;C:\Program Files\SQLLIB\bin\;C:\CMVC\exe\;C:\Program Files\IBM\WebSphere MQ\bin;C:\Program Files\IBM\WebSphere MQ\Java\bin;C:\Program Files\IBM\WebSphere MQ\WEMPS\bin;C:\Program Files\IBM\WebSphere Studio\Application Developer\v5.1.2\runtimes\base_v51\bin;c:\program files\mbna\tux\8.0x8\bin;%HummPATH%;C:\jdk150\bin

Java_Home - C:\jdk150

CLASSPATH - C:\Program Files\HostExplorer.nt\hcljrcsv.jar;C:\Program Files\HostExplorer.nt\;C:\jdk150\bin
*** Also Note: the classpath info in the compile command lind above
Paul Thorp
Greenhorn

Joined: Sep 12, 2006
Posts: 6
Sorry, Here is the tag handler class file I am trying to compile.

//*******************************************************************************
// Simple Tag Handler Class is
//*******************************************************************************
package com.example.misc;

import javax.servlet.*;
//import javax.servlet.jsp.JspException;
//import javax.servlet.jsp.tagext.SimpleTagSupport;
import java.io.IOException;



public class TagHandlerClass1 extends SimpleTagSupport {

public void doTag ()
throws JspException, IOException {

//*** The context object contains the response writer
getJspContext().getOut().print("Outpit from Simple Tag Handler");
}
}
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60812
    
  65

You didn't answer my question.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

What's this "SimpleTagSupport" class you are trying to extend? Is it the one in this comment here?
Paul Thorp
Greenhorn

Joined: Sep 12, 2006
Posts: 6
I made sure the two jar files servlet-api.jar and jsp-api.jar were in the classpath of the compile command. (see below and in the dos console log in the post above.

javac src\com\example\misc\TagHandlerClass1.java -d classes -classpath c:\aaaTomcat\common\lib\servlet-api.jar;c:\aaaTomcat\common\lib\jsp-api.jar;c:\TagSample\classes\com\example\misc;./classes
Paul Thorp
Greenhorn

Joined: Sep 12, 2006
Posts: 6
Thanks for the response Paul.

Yes it is the one that is commented out, but the shouldn't the import
import javax.servlet.*; just above that line complete the necessary import?
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

Originally posted by Paul Thorp:
Yes it is the one that is commented out, but the shouldn't the import
import javax.servlet.*; just above that line complete the necessary import?
Only if you're trying to import javax.servlet.SimpleTagSupport. If you were under the impression that javax.servlet.* meant anything starting with "javax.servlet.", that isn't how it works. You are only importing classes in the javax.servlet package.
Paul Thorp
Greenhorn

Joined: Sep 12, 2006
Posts: 6
I am not sure what I have done, but the program is now compiling.

I want to extend my sincere thanks for all of your help and support.

Thanks
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: SimpleTagSupport compile error
 
Similar Threads
Doubt in Simple Tag
JSTL + help needed
SimpleTag vs BodyTag
Doubt in SimpleTag
Cannot compile Tag Handler