Home Tutorialhelp Comment your class had errors

 
 

Comment

Greg
your class had errors,
February 5, 2009 at 11:55 PM

I cleaned up your code. It had multiple errors with return types, misspelled variables and classes, and illegal characters.

This compiles correctly:

package mytags;

import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;

public class Helloworld implements Tag {

private PageContext pagecontext;
private Tag parent;

public int doStartTag() throws JspException
{
return SKIP_BODY;
}

public int doEndTag () throws JspException
{
try {
pagecontext.getOut().write("Hello World");
}
catch(java.io.IOException ex)
{
throw new JspException("IO Exception");
}
return EVAL_PAGE;
}

public void release (){}

public void setPageContext(PageContext p)
{
pagecontext=p;
}

public void setParent(Tag t)
{
parent = t;
}

public Tag getParent()
{
return parent;
}
}

Since this is the first taglib tutorial I've ever tried, it was frustrating. It took me many hours to find out why.

The problem is in your class.

First of all, "Package" is lowercase. "Import" is also all lowercase. "Public" is also all lowercase.

"PageContext" needs to have capital "P" and "C", not just capital "P".
The property "pagecontext" doesn't have a capital "C".

The "JSPException" is also misspelled. It should be "JspException."

In the try/catch, "java.io.Exception" should be "java.io.IOException" - there is no "Exception"...it doesn't exist.

In your setPageContext() method, the data type of variable p is PageContext, not pageContext.

In your getParent() method, you have "void" for return type. It should be "Tag" instead of void.

Even though your code is horrible, I learned a lot by fixing it.

Sir, you can't just put tutorials like this online without testing the code for yourself!

There are a lot of beginners who need good tutorials. They need help, not confusion.



View All Comments | View Tutorial
Advertisement
Related Tutorial and Articles
JSP Servlet Questions

jsp errors - JSP-Servlet
jsp errors  Hi I got errors when running a jsp file I am giving the file. this is from rose india. I set the class path for 3 jar files i.e.... Now i am getting less errors compared to previous. But I am getting 2 errors 

Java Beginners

errors
errors  public class Win32OperatingSystem { public static void Shutdown(string machineName, string username, string password) { ManagementScope... that what the errors in above code 

Java Beginners

errors
errors  i am getting an error saying cannot find symbol class string.how do i rectify 

Java Beginners

query in simple code..i had described all...........
query in simple code..i had described all...........  SAME HERE... IS: abstract class A { abstract void callmetoo() { System.out.println("anoop"); } } ANOTHER FILE IS: class B extends A { void callme() { System.out.println 

Java Beginners

Getting 404 errors - Java Beginners
; public class login extends HttpServlet { protected void processRequest... { /* TODO output your page here out.println... I received a 404 errors and I identified that the servlet doesn't appear 

Struts Questions

How to validate a form in action class and forward errors to the jsp in struts?
How to validate a form in action class and forward errors to the jsp in struts?  How to validate a form in action class and forward errors to the jsp in struts 

Java Beginners

need to fix errors please help
modified your code. Check it. import java.io.*; class InputName{ static...need to fix errors please help  it does have 2 errors what should i fix? import java.io.*; class InputName static InputStreamReader reader = new 

Servlet Interview Questions

compilation errors
javax.servlet.http.HttpServletResponse; public class WelcomeServlet extends HttpServlet...() { } } giving errors: 1) WelcomeServlet.java:37: ')' expected 

Java Beginners

getting errors
getting errors  public class positive { public static void main(String[] args) { retainPositiveNumbers(a); } private static int n... integers in another array. import java.util.*; public class positive { public 

Hibernate Questions

Calling hibernate query list() method generates errors
asking your help about this. I am trying to retrieve a list of jobs from the database, but there seems to be a problem. In the entity class: //JobEntity... of the job id from REFRESH to PERSIST, but still the same errors occur. Does cache 

Java Beginners

Compiler errors in java
Compiler errors in java  Hi, I used GenerateRDF java file. Am getting errors when i run this code. I used command prompt only. getting errors as no package exist. i followed your instructions properly. Please help me out 

JSP Servlet Questions

Servlets errors in same page.
Servlets errors in same page.  How do I display errors list in the same page where a form field exists using servlets...........i.e. without using JSP? Please explain with a simple username password program 

Java Beginners

Java Program Errors
Java Program Errors  These are the 2 errors which I am getting when... was not built since its build path is incomplete. Cannot find the class file... ControlPoint cannot be resolved. It is indirectly referenced from required .class 

Java Beginners

Correct errors - Java Beginners
Correct errors  Identify and correct the errors in the following program: public java Method { public static method1(int n, m) { n += m... Friend, Try the following code: public class Example{ public static void main 

Java Beginners

Java errors - Java Beginners
uploaded three files to rapidshare.com: 1. the main class: link:- http 

WebSevices Questions

I had this error while deploying a web services in jboss
I had this error while deploying a web services in jboss  Error configuring application listener of class com.sun.xml.ws.transport.http.servlet.WSServletContextListener: java.lang.ClassNotFoundException 

Java Beginners

Java errors when attempting the following.
Java errors when attempting the following.  Give the java errors in attempting the following : 1) performing division operation on string value. 2) redefining base class final method in derived class. 3) defining a method 

Java Beginners

remopving errors incore java programming
remopving errors incore java programming  sir error in program:-file does not contain class runnable program:- class MyRunnable implements Runnable{ public void run(){ System.out.println("Run"); } public 

Java Beginners

remopving errors incore java programming
remopving errors incore java programming  sir error in program:-file does not contain class runnable program:- class MyRunnable implements Runnable{ public void run(){ System.out.println("Run"); } public 

Java Beginners

remopving errors incore java programming
remopving errors incore java programming  sir error in program:-file does not contain class runnable program:- class MyRunnable implements Runnable{ public void run(){ System.out.println("Run"); } public 

JSP Tutorials

Runtime Errors
Runtime Errors          Errors are arised when there is any logic...; <TITLE>Runtime Error in Jsp page</TITLE> </HEAD> 

JSP Servlet Questions

Robot Class - JSP-Servlet
, We have modified your code: function hello 

JSP Servlet Questions

how to include a java class in jsp - JSP-Servlet
. actually i have a class in which i had written the backend process code and want...how to include a java class in jsp  hello sir, this is my first question, i want know that how to use a java class function's variables 

Applet Questions

Help please, some strange errors
this errors so i have posted the whole program here. Here i tried to make the monopoly... is causing that run-time errors? Any kind of help will be helpful to me. and let... classes here like Property,Player, main class etc.. I hope i will get some 

Struts Questions

how to display action errors in jsp which is in a form list
how to display action errors in jsp which is in a form list  My jsp contains list of forms iterating using display:table, each FORM forms a row. I want to display action errors for individual form in the same row 

JSP Servlet Questions

Class files for Jfreechart - JSP-Servlet
Class files for Jfreechart  Respected Sir/Madam, I am... Charting application in JSP.. I have also compiled around 100 files for it.. Though, I found some of the class files are missing.. So, I request you to send 

Struts Questions

Display Errors using Message Resources - Struts
Display Errors using Message Resources  Hello.. I've a login page where i used applicationresources.properties to display errors for null values and i wrote the condition in formbean. Now i want to show the errors for invalid 

JSP Servlet Questions

bad class file - JSP-Servlet
bad class file  (from the JAVA SERVLET PROGRAMMING - O'Reilly) and got a "bad class file...): myservlet.java:9: cannot access HttpServlet bad class file: \HttpServlet.class...bad class file. I'm (desperately) trying to get 

PHP Tutorial

How to show all errors in PHP?
How to show all errors in PHP? I this tutorial I will explain you how you can make changes in your code for displaying all the warning and error messages in your PHP program. This is one of the most asked question "How to show 

Struts Questions

I tried to create a dropdown list using struts2.it is not working.can you find the errors in this code?
the errors in this code?  /jsp code for creating dropdownlist using...;//submit </p:form> </body> </html> /java action class for adding... java.sql.SQLException; import java.util.ArrayList; public class EmpAdd extends 

JSP Servlet Questions

Using a user defined non-packaged servlet class in jsp. - JSP-Servlet
Using a user defined non-packaged servlet class in jsp.  i want know... example. actually i have a class in which i had written the backend process code and want to use those variables in my jsp for further process 

Java Beginners

Coding errors for printing function, please help
Coding errors for printing function, please help  Hello, We, my... it is not actually printing the persons class schedule, we have currently coded the print button for class schedule to bring up the printer menu. I can email the program too 

JDBC Questions

verify the code and give me the code with out errors
; import java.util.Date; public class add { String msg; JFrame f; JPanel p... clear the errors and give me correct tutorial for my knowledge improving.pls anyone 

JSP Servlet Questions

JSP - JSP-Servlet
had mentioned what the error says & where, your question can be answered more...JSP  Thanks for your reply....regarding dbase connection using beans. i am using tomcat 5.0. I want to know where i have to place this class file 

Java Beginners

<errors><error><domain>yt:quota</domain><code>too_many_recent_calls</code></error></errors>
? Thanks   Hi, If your application is receiving such error, then stop your application and wait for 10-15 minutes. Then start the application, after... if your limit exceeds the quota. You will get the error in following xml format 

Hibernate Questions

Any specific log4j statements for Hibernate Envers for showing the Envers related errors
project. If there is any specific errors related to hibernate envers those are not coming in console. We had the following statements in log4j 

XML Tutorials

Handling Errors While Parsing an XML File
Handling Errors While Parsing an XML File       This Example shows you how to Handle Errors While... below for Handling Errors:-SAXParserFactory saxpf = SAXParserFactory.newInstance 

JSP Servlet Questions

Generated java file - JSP-Servlet
to compile class for JSP: An error occurred at line: 7 in the generated java file...Generated java file  Hello friends, At run time JSP files.... logout.jsp--includes- logersout.jsp as final code. As soon as a member had 

JSP Servlet Questions

Doubt in using combination of JSP page and Java class. - JSP-Servlet
Doubt in using combination of JSP page and Java class.   I've got... be disabled from clicking. How to go about doing this in a "JSP Page using a Pure Java class"? The Database table looks like this: SeatCode 

HTML Questions

check for errors
check for errors  How can I check for errors 

JSP Servlet Questions

jsp runtime error - JSP-Servlet
-jsp\readingWriting_0005fexcel$jsp.java:5: Class...jsp runtime error  sir, when i am running ur prog... from this website.... http://www.roseindia.net/jsp/poi/readingWriting.shtml i did the same 

Development process Questions

jsp
org.apache.jasper.JasperException: Unable to compile class for JSP: An error occurred at line: 7 in the jsp file: /jsp/insertdate.jsp month cannot be resolved 4...jsp  when i compile the dateOfBirth.html i got the following errors 

Java Beginners

Importing Your Own Package
Importing Your Own Package  I would like to know if it is possible to create a class with your own methods so that you can import them when writing programs 

Java Beginners

What is the errors?
What is the errors?  ) while ( c <= 5 ) { product *= c; ++c;   if ( gender == 1 ) cout << "Woman" << endl; else; cout << "Man" << endl;   Post the whole code 

Java Tips and Examples

Controlling your program
Controlling your program      ... is and that too without making any errors. Until now we have learnt how to use... is the code of the program :  public class Continue 

Programming Tutorials

Forgot Password Action,Struts Forgot Password Action class
when you forgot your password and want to recover the password. The forgot password action requires user name and passwords same as you had entered during...=strPasswordEmail[2]; String subject="Your username & password "; String message 

JSP Servlet Questions

jsp
= "java.io.*" errorPage = "" %> <jsp:useBean id = "formHandler" class...;p>%> <jsp:useBean id="formHandler" class="testing.Beanform" scope...;/p> <pre class="prettyprint">errors= new Hashtable(); } public String 

JSP Servlet Questions

jsp
= "java.io.*" errorPage = "" %> <jsp:useBean id = "formHandler" class...;p>%> <jsp:useBean id="formHandler" class="testing.Beanform" scope...;/p> <pre class="prettyprint">errors= new Hashtable(); } public String 

Java Magazine Questions

java errors
 

Java-Tutorials

Exception Handling
; Exception, that means exceptional errors. Actually exceptions are used for handling errors in programs that occurs during the program execution. During the program execution if any error occurs and you want to print your own 

JSP Servlet Questions

jsp error - JSP-Servlet
jsp error  HTTP Status 404 - /jsp... message /jsp/ description The requested resource (/jsp/) is not available... and did not reveal the reason why. 404 errors should not be confused 

JSP Servlet Questions

JSP error: class UserForm not found in class model.UserAction
JSP error: class UserForm not found in class model.UserAction  etting the following error in the program..wat shod i do to remove this?I am using... org.apache.struts.actions.IncludeAction; public class UserAction extends DispatchAction { private 

PHP Questions

types of errors in php
types of errors in php  What are the different types of errors in php 

JSP Servlet Questions

jsp and ajax - JSP-Servlet
jsp and ajax  i had some problem i want to display the current... this link to find the solution about your problem. http://www.roseindia.net/jsp/fileupload.shtml Thanks 

Job Tips

Get Noticed with Your Resume
Get Noticed with Your Resume     ... the importance of your resume- they tell you that your resume can make or break your chances... opportunities than it had a couple of decades back- the IT boom has created many 

Struts 2 Tutorials

Example of ActionSupport class
Example of ActionSupport class Struts ActionSupport class provides the default... the errors(). clearMessages() - It clears all the messages(). ActionSupport  class also provides some fields LOG, textProvider, validationAware An example 

WebSevices Questions

Unable to compile class for JSP - WebSevices
Unable to compile class for JSP  org.apache.jasper.JasperException: Unable to compile class for JSP When I am trying to access a java file kept under src folder under a package from a jsp page placed under web directory, I am 

JSP Servlet Questions

Why System class not in jsp - JSP-Servlet
Why System class not in jsp  Hi Friends, why system.out.println("") not working in jsp . But out.println is working I want the reason pz . Thanks Prakash 

JSP Servlet Questions

how to call a java class in jsp - JSP-Servlet
how to call a java class in jsp  hi.. friends iam new to roseindia.i... class in a jsp.can anyone please help me with this query... : Example of Extends Attribute of page Directive in JSP 

JSP Servlet Questions

how to call a java class in jsp - JSP-Servlet
how to call a java class in jsp  hi.. friends iam new to roseindia.i... class in a jsp.can anyone please help me with this query... : Example of Extends Attribute of page Directive in JSP 

Web Services

WEBSERVICE USING APACHE AXIS - TUTORIAL-2 AXIS FOR EJB-WEBSERVICE (part-5)
; In DeveloperIQ ( March-2004) , we had seen parts 1 to 4 of this tutorial...; "It is entirely possible to package your business logic into Java Beans and not worryabout the EJB API.However,as your business logic becomes more 

General

Java error class
Java error class     ... able class. This mean the application does not able to catch the error occurred... class and its subclass define the object to be thrown and the message to be appear 

JSP Tutorials

The import Attribute of page Directive In JSP
package or the class in your jsp application. Here a Java code has also been provided which class has been imported in the following JSP code like <%@page... The import Attribute of page Directive In JSP   

JSP Servlet Questions

Static database class - JSP-Servlet
Static database class  I want to create a static database class and i want to use that class in all servlets ? How can i achive 

JDBC Questions

jdbc-jsp
jdbc-jsp  <html> <head> <title>your info mail<...;<font color=#1f2e3c>your info mail</font></u></center>... into database but the field names should be different while giving. You had used same name 

Struts Questions

how to pass string array from action class to jsp page? pls reply me.
how to pass string array from action class to jsp page? pls reply me.  how to pass string array from action class to jsp page? pls reply me.  .... In your action class, String[] arr = {"A","B","C","D"}; for (int x = 0; x < arr 

JavaScript Questions

selectoptions errors in java script
selectoptions errors in java script  hi, in my web page when I select the color of the image it displays that particular color but when i again opt the select option it displays errors message. How do I rectify this problem 

JSP Servlet Questions

Convert String to Class - JSP-Servlet
. Reading job name, class name, day & time using xml file only. Problem is while reading class name, retrieve as a string format but Quartz required in "Class" format 

Spring Framework

The errors tag
In this section, you will learn about the errors tag of the Spring form tag library 

JSP Tutorials

Java class in JSP
Java class in JSP          To use a Java class method in jsp first we need... the jsp page we now need to create an object of the class by using the new operator 

Java Beginners

Simple Java class program - Java Beginners
your code and handle any errors that may arise. Thank you Alexander ...Simple Java class program  Hi sir, Please help me Write a simple class that iterates through all the arguments passed in on the command line 

JSP Servlet Questions

jsp function - JSP-Servlet
jsp function  how to make function in jsp... i want example of jsp... and print that data.. don't want javascripts..  Writing Method in JSP an Example We can write functions or methods into JSP using the Declaratives tags 

Java Beginners

robot class
in the programming. where exactly robot class is useful. why is it necessary... provide the class Robot. It gives the java program much power. It can perform all the function that you can do with your mouse and keyboard.The program has even 

Java Beginners

Scanner class
Scanner class  import java.util.*; class Dd { public static void...; Here your code works fine..Which java version you are using? Actually Scanner class was introduced in java 5 

Training

JSP Training
in JSP Pages What is Custom Tag? Building Your first custom JSP Tag Types... and Databases JSP Errors Debugging JSP Errors Custom error page Looking towards... JSP Training     Java Server Pages 

JSP Servlet Questions

srvlet compilation error - JSP-Servlet
class not found errors & many such class not are generated.   Hi Friend... the servlet-api.jar into the lib folder of your apache tomcat folder.Then set the classpath and restart the compiler to compile the class. Thanks 

Spring Framework Questions

Spring MVC, request object in val;idator class
variable in the commandClass there is a binding on jsp, which populates the variable. Now there may be some elements on your view which are not bound to any... question - How will you get these parameters in the validator class and validate 

General

Commenting out your code - Java Tutorials
errors But the given below code compile : public class Sample2... class Sample{ Character a= new Character('\u000d'); } When... will comment it so that at least it will get compile : public class Sample 

JSP Interview Questions

how to set the class path variable in tomcat ?
;jsp:useBean id="test" class="action.TestBean" /> <jsp:setProperty name...;The error lies in your jsp code. Check the syntax properly of using Bean. Anyways...how to set the class path variable in tomcat ?  description 

JSP Servlet Questions

jsp - JSP-Servlet
jsp  The value for the useBean class attribute SQLBean.DbBean is invalid. This is JSP page... package SQLBean; import java.sql.*; import java.io.*; public class DbBean 

JSP Servlet Questions

what are the jar files should i add to resolve the Exception(Class org.apache.jsp.index_jsp Not Found) ?
cannot find servlet class org.apache.jsp.index_jsp or a class it depends...what are the jar files should i add to resolve the Exception(Class org.apache.jsp.index_jsp Not Found) ?  what are the jar files should i add 

Struts Examples

Actionerror and Actionmessage Tags (Non-Form UI Tags) Example
action errors (in the jsp pages.) if they exists while the actionmessage tag...;/action> <action name="login" class... an action class that uses methods addActionMessage(String) and addActionError 

Java Beginners

I need your help - Java Beginners
I need your help  What is the purpose of garbage collection in Java, and when is it used?  Hi check out this url : http://www.artima.com.../gc/g1_intro.jsp 

Struts Questions

STRUTS2.0 Validation Errors
the previous field errors persist in the page. For eg:if i am not entering both 

PHP Questions

WHAT ARE THE DIFFERENT TYPES OF ERRORS IN PHP?
WHAT ARE THE DIFFERENT TYPES OF ERRORS IN PHP?  WHAT ARE THE DIFFERENT TYPES OF ERRORS IN PHP 

JSP Servlet Questions

file uploadind - JSP-Servlet
file uploadind   had pasted the provided 2 files(1.index_single_upload.jsp, 2.Sinle_upload_page.jsp) for file uploading it is showing errors in the apache tomcat like "content type cannot be resolved to a type" pls help 

JSP Servlet Questions

jsp - JSP-Servlet
:\apache-tomcat-6.0.18; 2)CLASS_PATH= C:\apache-tomcat-6.0.16; Create application folder inside C:\apache-tomcat-6.0.18\webapps and put your jsp file...jsp  how can i do program in jsp ???   Hi Friend 

Programming Tutorials

Tips for Increasing Money Making Abilities of Your Articles
idea for checking your errors. Checking our own article can be tough... Tips for Increasing Money Making Abilities of Your Articles... your online business is an extremely cost effective and powerful method 

JSP Servlet Questions

JSP - JSP-Servlet
JSP  Thank you very much for your fast reply.. Now it is working... In my project I have to insert the data from different JSP pages. I know one... that "use only one class file. In that class file write all the connections to dbase 

Struts 2 Tutorials

Struts2.2.1 handle multiple Submits in your application
Struts2.2.1  handle multiple Submits in your application  ... -- Directory structure of the Example- First we create a JSP file named...;h3>Please enter your order details</h3> <s:form 

Struts 2 Tutorials

Struts2.2.1 fielderror Tag Example
field errors if they exists. The following Example will shows how to implement the fielderror tag in the Struts2.2.1 -- First we create a JSP file named...;action name="FieldErrorTag" class=" 

JSP Servlet Questions

JSP-EL - JSP-Servlet
JSP-EL  Dear Sir, I know that this below code run on your... Application server weblogic 8.1. In weblogic 8.1 allthough execute the JSP... is: Home.html A simple JSP application EL Uisng In JSP Name 

Java-Tutorials

Java Exception Class Hierarchy Diagram
class. The class Exception and its subclasses are defined in such a way that an application may generate a condition which might be caught. The Exception class extends the Throwable class. All errors and exception classes are the subclasses 

Struts-Tutorials

The ActionForm Class
the error on the jsp page <html:errors/> tag is used. The <html:errors... The ActionForm Class   ... validation of data, the data will be sent to model (the action class 

PHP Tutorial

PHP Displaying the date and time in your timezone Tutorial
PHP Date Time Zone       In PHP Date Time Zone class displays the time of different time zone, along with time it is also capable of displaying the longitude, latitude and comment 

JSP Servlet Questions

servlet - JSP-Servlet
*; ^ Avanthi.java:7: cannot find symbol symbol: class HttpServlet public class Avanthi extends... symbol symbol : class ServletException location: class Avanthi public...{ ^ Avanthi.java:39: cannot find symbol symbol : class ServletRequest location: class 

JSP Servlet Questions

JSP-EL - JSP-Servlet
JSP-EL  Dear Sir, You gave me that code: Home.html A simple JSP application EL Uisng In JSP Name... of Expression Language in jsp Hello ${vij.name 

Java Beginners

java class - Java Beginners
it is showing errors for packages which i have imported.? how to run those classes and jar files at a time to avoid compilation errors and run time errors 

Swing AWT

compilation errors - Swing AWT
 

PHP Questions

php display errors
 

Advertisements Advertisements
 

 

 

DMCA.com