• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • paul wheaton
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Piet Souris
Bartenders:
  • salvin francis
  • Mikalai Zaikin
  • Himai Minh

SimpleTagSupport compile error

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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???
 
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Sheriff
Posts: 67529
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
Paul Thorp
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Sheriff
Posts: 67529
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You didn't answer my question.
 
Marshal
Posts: 26537
81
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What's this "SimpleTagSupport" class you are trying to extend? Is it the one in this comment here?
 
Paul Thorp
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Marshal
Posts: 26537
81
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic