HELP: Import my own class in JSP ???

Hi, all!
I read many previous topics in this forum but no one works for me!
Please someone help me!
I'm using Tomcat 4.1.12 and my JSP scripts work just fine, but I need to import my own .class file. I just don't know where to put it so Tomcat can find it!?
I have this environment variable:
JAVA_HOME=.;c:\jdk1.3.1
And in my code I'want to place something like this:
<%@ page import="myClass" %>
But I get a "can not resolve symbol" exception.
Thanks for readind this, and please help if you can!
Bye.
adriano

Within the Tomcat directory, under your application directory place the class file/s into the WEB-INF/classes directory. If your classes are part of a package place the entire directory structure of the package under the WEB-INF/classes directory.
The import in the JSP is the same as for any Java class.
Hope this solves your problem.

Similar Messages

  • NullPointerException - importing my own class to JSP

    Hi.
    I'm writing a JSP page. I also made a class in WEB-INF/classes/org/MyXml.class. When I try to run this class from console, there is no problems at all. But if i try to use function from that class in JSP, i get this (the same error i get whichever function i try to use (btw, all functions are static, as they should be, right?)):
    java.lang.NullPointerException
         org.MyXml.CountProducts(MyXml.java:46)
         org.apache.jsp.index_jsp._jspService(index_jsp.java:75)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    I used this class like this:
    <%@ page import="org.MyXml" %>
    <%
    MyXml.CountProducts();
    %>
    I'm also a bit confused, it says that error is on line 46. Well, there's just a comment!
    Please help. Thanks.

    pqeuens,
    MyXml is his class. his methods are static, so, import="org.MyXml.*" won't work. It would either be import="org.*" or import="org.MyXml" (which he has)
    paull1911
    "What file are you looking at to find line 46? It is the java file (a servlet) corresponding to the jsp file."
    It should actually be in the org.MyXml.java file. The stack trace line is:
    java.lang.NullPointerException
    org.MyXml.CountProducts(MyXml.java:46)
    someone_
    You know from the above error line that the error is in MyXml.CountProducts method. After making sure you are working with the most up-to-date version of the class, (if that doesn't help you get a more accurate line number) walk through the CountProducts method and see where you might be trying to access an object that has not yet been instantiated (either using someObject.someMethodOrMember, or someArray[index])

  • How to import  my own class in jsp file

    I have a jsp file in jsp\ directory and a class in web-inf\classes\ directory. How do I import the class in jsp so i can use it in my jsp file. Thanks,

    This is your lucky day, wennie.
    The correct forum to post this is:
    [http://forums.sun.com/forum.jspa?forumID=45]

  • Help - import own classes in jsp

    Hey guys..
    I'm working on a Shopping cat project which is in the directory -
    C:\Tomcat 6\webapps\ROOT\cart
    I've written one code in shop-product.jsp as below -
    <%@ page language = "java" contentType = "text/html"
             import = "ShoppingBasket, Product, java.sql.*"
             errorPage = "errorpage.jsp" %>
    <html>
    <head> <title>Welcome to Shop</title></head>
    <body>
    <table width = "385" border="0" cellspacing="0">
    <tr>
    <td colspan="4">More Books from me</td>
    </tr><tr>
    <td colspan="4" align ="right">
    <a href = "<%=response.encodeURL("shop-basket.jsp") %>"> View Basket </a></td>
    </tr><tr>
    <td><b>Ref</b></td><b>Title</b></td>
    <td><b>Price</b></td></td></tr>
    <%
    Class.forName("org.gjt.mm.mysql.Driver").newInstance();
    Connection connection = null;
    connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/shop", "root", "rahul");
    Statement stmt = null;
    ResultSet RS = null;
    stmt = connection.createStatement();
    RS = stmt.executeQuery("select * from items");
    int rowCounter = 0;
        while(RS.next())
          String item_id = RS.getString("id");
          String title = RS.getString("title");
          String desc = RS.getString("desc");
          String price = RS.getString("price");
          rowCounter=rowCounter+1;
          String bg=  (rowCounter % 2 !=0) ?"#C0C0C0":"#ffffff";
    %>
    <tr bgcolor = <%=bg%>">
    <td><%=item_id%></td>
    <td><b><%=title %></b><br/><%=desc%></td>
    <td><b><%=price %></b></td>
    <td>
    <a href =" <% response.encodeURL("shop-products.jsp?title="+title+"&item_id="+item_id+"&price="+price); %> "> Add to Cart </a></td>
    </tr>
    <% } RS.close(); connection.close(); %>
    </table>
    <jsp:useBean id = "basket" class = "ShoppingBasket" scope = "session"/>
    <% String title = request.getParameter("title");
       if(title!=null)
         String item_id = request.getParameter("item_id");
         double price = Double.parseDouble(request.getParameter("price"));
         Product item = new Product (item_id, title, price);
         basket.addProduct(item);
    %>
    </body></html>{code}
    in which ShoppingBasket and Product are the classes which I want to import. Where should I put those class files if my project path is 
    +C:\Tomcat 6\webapps\ROOT\cart+
    I've put class files into Tomcat_home/lib but it is giving me error
    {code}type Exception report
    message
    description The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    org.apache.jasper.JasperException: Unable to compile class for JSP:
    An error occurred at line: 6 in the generated java file
    The import ShoppingBasket cannot be resolved
    An error occurred at line: 7 in the generated java file
    The import Product cannot be resolved
    An error occurred at line: 62 in the jsp file: /cart/shop-products.jsp
    The method addProduct(Product) in the type ShoppingBasket is not applicable for the arguments (Product)
    59:      String item_id = request.getParameter("item_id");
    60:      double price = Double.parseDouble(request.getParameter("price"));
    61:      Product item = new Product (item_id, title, price);
    62:      basket.addProduct(item);
    63:    }
    64: %>
    65: </body></html>
    Stacktrace:
         org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:92)
         org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
         org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:439)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:349)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:327)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:314)
         org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:592)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    note The full stack trace of the root cause is available in the Apache Tomcat/6.0.29 logs.{code}
    Please assist me on, how to import my custom made class files..
    Thanks,
    Rahul...                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    What You need to do is to place ShoppingBasket class in a package and import to fully qualified class name (which is class name with package name). I also discourage You to use scriptlets - it's an obsolete, old technology.

  • Importing my own classes

    I have 2 simple classes in the same directory and I'd like to test the use of import to import one class into the other. Upon compilation of the class thats doing the import, I get a compilation error. Herewith the details, where could I be getting it wrong.
    ****code for class to be imported****
    import java.util.Date;
    public class printer
    public void print()
    System.out.println(new Date());
    System.out.println("Hello World");
    --The above code compiles with no problems.
    ***Code for the main class that imports the above*****
    import printer;
    public class myapp
    public static void main(String[] args)
    (new printer()).print();
    -upon compiling the second class above, myapp.java, I get the following errors:
    C:\java\source>javac myapp.java
    myapp.java:1: '.' expected
    import printer;
    ^
    myapp.java:1: ';' expected
    import printer;
    ^
    2 errors

    Moreover, classes do not need to import any class which is in the same package as their own, and since your printer class is in the default package (if you call that a package) you shouldn't need to import it into myapp anyway

  • Problem to Import my own classes

    I try to import own classes to unother class
    I have all classes in the same map
    import StockTablePanel;
    when I tried to compile the code it says
    �.� expected
    StockTablePanel;
    What is wrong?

    I try to import own classes to unother class
    I have all classes in the same mapAlso if by the same map you mean the same folder then you don't even have to import the class.

  • Help! Cant import my own classes?

    Hi all, I really need some help.
    I created a swing browser application in my working folder called Swiki.
    Then I found a open source package that I want to use some of its classes.
    I put that package into a subfolder (cos it has many subfolders itself).
    I am having a problem importing that package into my own browser.java.
    I tried:
    import Kizna.*;
    OR
    import Kizna.src.com.kizna.*;
    when I try to create an instance of one of the classes:
    public HTMLParser myParser
    The error says:
    "HTMLParser.java": Error #: 901 : package com.kizna.html stated in source C:\Swiki\Kizna\src\com\kizna\html\HTMLParser.java does not match directory Kizna.src.com.kizna.html at line 1, column 19
    can someone help?
    thanks
    TC

    When the compiler and runtime are trying to find files, it converts the import statements to directories, so:import com.kizna.html.*;will look under a directory structure "com/kizna/html/". Then, it will look through your classpath and look to see if this directory structure exists in any of the directories specified in the classpath. That means, if your classpath is ".;C:\SomeDir;C:\AnotherDir", it will first look for class files in ".\com\kizna\html\". If it doesn't find the file it is looking for in there, it will look in "C:\SomeDir\com\kizna\html\". If it still doesn't find the file, it looks in "C:\AnotherDir\com\kizna\html\". If the file doesn't exist in any of these, you will get a compiler error.
    Points to remember:
    1)     Classes in a package, when compiled, must always be in a directory tree that matches the package structure. That is, if you have a class called MyClass in package mypackage.subpackage, then the "MyClass.class" file must be in a directory called "subpackage" which in turn is in a directory "mypackage".
    2)     Your import statements must match the actual package name of the class. You must import "mypackage.subpackage.*" above; importing "subpackage.*" will not work.
    3)     Your classpath must consist of all the base directories of your package directory tree. In the above example, your classpath must include the directory that contains the directory "mypackage".
    Thus, the compiler will look through all combinations of <classpaths>/<import package tree>/MyClass.class to find the file for class MyClass. Here, <classpaths> are the paths given in your classpath and <import package tree> are thre directory structures for the packages you import. So, in your case, you want your classpath to include "C:\kizna\classes" and your import statement to be "import com.kizna.html.*". Note that including "C:\kizna\classes\com" in the classpath and importing "kizna.html.*" will not work (even though the combination gives the correct "location") because your import statement does not match the actual package name given to HTMLParser. While this may seem strange that this isn't allowed, it is done to ensure that classes are unique (classes may use the same name if they are in different packages).

  • How to import non-package class in JSP ?

    We have develped an enterprise solution in java 1.3 . Some of the controller and controller helper classes donot have any package structure. So they are been kept in web_inf/classes. When any jsp tries to refrence these classes class not found exception arise.
    One solution is to put these classes in package and write approprite import statement. But this involve lot of changes. Kindly suggest a solution which can have minimum impact.
    I have even jared all these classes into a jar and put that jar in the class path. But still its not working.

    It should not be web_inf , the case and the spelling matters it should be WEB-INF , make that correction and see if it works.
    If not then, use an IDE to refactor your code.
    Some good IDEs with refactoring capabilities are
    IntelliJ IDEA - commercial
    NetBeans - open source I think (not sure)
    Eclipse Web Tools - also open source
    Using packages is a good practice, and will make your application more understandable.
    Message was edited by:
    appy77

  • Import user defined class in JSP page

    In my test.jsp page, I tried to display the user name using the value returned from a class UserInfo's static function getUsername(), like this:
    <%@page import="toystore.view.UserInfo" %>
    <html:text property="username" value="<%= UserInfo.getUsername()%>"
    Is this allowed? I tried to run it but failed, it complained:
    OracleJSP: oracle.jsp.provider.JspCompileException:
    Errors compiling:D:\java\bc4jtoystore\ToyStoreController\classes\.jsps\_web_2d_inf\_jsp\_signin.java
    Line # Error
    0 cannot access class toystore.view.UserInfo; file toystore\view\UserInfo.class not found
    64 variable UserInfo not found in class web2d_inf._jsp._signin
    If it is allowed, what is the correct way to do it?
    Thanks.
    P.S. UserInfo is compiled in toystore.view package.

    check your classpath. it looke like the compilers complaining that it can't locate your toy store package location not that there is a problem with your jsp. Hope this helps

  • Import my own class into servlet problem

    Hello, everyone.. I fail to import java classes that i create myself into the servlet. I wonder what is the problem. I would feel grateful if anyone can solve my problem. I noe that if it is in the package let say myclass , C:\jakarta-tomcat-4.1.29\webapps\lis\WEB-INF\classes\myclass. It will be
    package myclass;
    import myclass.*;
    But, I put all my class file into below directory not in a package.
    C:\jakarta-tomcat-4.1.29\webapps\lis\WEB-INF\classes
    and i wish to include let say DBManager.class file into Login.class file which in in the same directory as above. What is the correct code i should put? Thanks for anyone who willing to help me out ~

    You don't need to import classes from the same package. They are automatically available in the same namespace. Just use them.
    package myclasses;
    import myclasses.*;  // this line does nothing
    import myctherclasses.*;  // this line is necessary to use classes from another package.Having said that though, it is always preferable to put your classes in a package. Classes in the "unnamed" package are not guarunteed to be available anymore.
    Particularly servlet classes which are not in a package aren't found by Tomcat.
    In short: always put your classes into packages.
    Cheers,
    evnafets

  • Import my own class

    I created two classes in the same package (myclass). one of them is using another class. what is the syntext of import another class: I tried import myclass.* also import myclass.class1. it didn't work. Thanks,
    j

    For class1.java in mypackage directory:
    package mypackage;
    public class class1 { }
    For class2.java in mypackage directory:
    package mypackage;
    public class class2 { }
    For a file myclass one level out of mypackage:
    import mypackage.*;
    public class myclass {
    public static void main(String[] args) {
    class1 c1 = new class1();
    Something like that should work.

  • Help with creating own classes then manipulating with an array

    import java.util.Scanner;
    public class Booking {
        private String bookingId;
        private String bookingName;
        private int numberOfPassengers;
        public Booking(String bookingId, String bookingName, int numberOfPassengers) {
            bookingId = bookingId;
            bookingName = bookingName;
            numberOfPassengers = 0;
        public static final double BASIC_RATE = 80;
        public String getBookingId() {
            return bookingId;
        public String getBookingName() {
            return bookingName;
        public int getNumberOfPassengers() {
            return numberOfPassengers;
        public double calculateBookingPrice() {
            return (BASIC_RATE * numberOfPassengers);
        public void summary() {
            System.out.println("Booking Number: " + bookingId);
            System.out.println("Booking made for: " + bookingName);
            System.out.print("Booking Price: $");
            System.out.printf("%6.2f", calculateBookingPrice());
    public class CabinBooking extends Booking {
        private String cabinNumber;
        private boolean dinner;
        public CabinBooking(String cabinNumber, boolean dinner) {
            super(bookingId, bookingName, numberOfPassengers);
            cabinNumber = cabinNumber;
            dinner = false;
        public String getCabinNumber() {
            return cabinNumber;
        public void upgradeBooking(boolean status) {
            dinner = false;  
        public double calculateBookingPrice() {
            double dinnerCost;
            dinnerCost = 40;
            return(300 + ((numberOfPassengers - 2) * 100) +
                (numberOfPassengers * dinnerCost));
        public void summary() {
            super.summary();
            System.out.println("Cabin Number: " + cabinNumber);
            if (dinner = false)
                System.out.println("Dinner Included: No");
            else
                System.out.println("Dinner Included: Yes");
                System.out.print("Dinner Booking Fee: $");
                System.out.printf("%6.2f", calculateBookingPrice());
    public class Booking {
    public static void main (String[] args) {
        String bookingId, bookingName;
        int i;
        Scanner keyboard = new Scanner(System.in);
        Booking[] bookings = new Booking[5];
            bookings[0] = new Booking("C001", "Dorothy the Dinosaur", 1, "C23");
            bookings[1] = new Booking("B001", "Bob the Builder", 1);
            bookings[2] = new Booking("C002", "Donald Duck", 4, "B10");
            bookings[3] = new Booking("C003", "The Wiggles", 4, "D14");
            bookings[4] = new Booking("B002", "Mickey Mouse", 2);
            bookings[5] = new Booking("B003", "Hi Five (Minus One)", 4);
        for (i=0; i<5; i++) {
            System.out.println("List of booking ID's and names:");
            System.out.println();
            System.out.println("Booking Number: " + (i+1) + "Booking made for: " + (i+1));
            bookings[i] = new Booking(bookingId, bookingName);
    }

    import java.util.Scanner;
    public class Booking {
        private String bookingId;
        private String bookingName;
        private int numberOfPassengers;
        public Booking(String bookingId, String bookingName, int numberOfPassengers) {
            bookingId = bookingId;
            bookingName = bookingName;
            numberOfPassengers = 0;
        public static final double BASIC_RATE = 80;
        public String getBookingId() {
            return bookingId;
        public String getBookingName() {
            return bookingName;
        public int getNumberOfPassengers() {
            return numberOfPassengers;
        public double calculateBookingPrice() {
            return (BASIC_RATE * numberOfPassengers);
        public void summary() {
            System.out.println("Booking Number: " + bookingId);
            System.out.println("Booking made for: " + bookingName);
            System.out.print("Booking Price: $");
            System.out.printf("%6.2f", calculateBookingPrice());
    class CabinBooking extends Booking {
        private String cabinNumber;
        private boolean dinner;
        public CabinBooking(String cabinNumber, boolean dinner) {
            super(bookingId, bookingName, numberOfPassengers);
            cabinNumber = cabinNumber;
            dinner = false;
        public String getCabinNumber() {
            return cabinNumber;
        public void upgradeBooking(boolean status) {
            dinner = false;  
        public double calculateBookingPrice() {
            double dinnerCost;
            dinnerCost = 40;
            return(300 + ((numberOfPassengers - 2) * 100) +
                (numberOfPassengers * dinnerCost));
        public void summary() {
            super.summary();
            System.out.println("Cabin Number: " + cabinNumber);
            if (dinner = false)
                System.out.println("Dinner Included: No");
            else
                System.out.println("Dinner Included: Yes");
                System.out.print("Dinner Booking Fee: $");
                System.out.printf("%6.2f", calculateBookingPrice());
    public static void main (String[] args) {
        String bookingId, bookingName;
        int i;
        Scanner keyboard = new Scanner(System.in);
        Booking[] bookings = new Booking[5];
            bookings[0] = new Booking("C001", "Dorothy the Dinosaur", 1, "C23");
            bookings[1] = new Booking("B001", "Bob the Builder", 1);
            bookings[2] = new Booking("C002", "Donald Duck", 4, "B10");
            bookings[3] = new Booking("C003", "The Wiggles", 4, "D14");
            bookings[4] = new Booking("B002", "Mickey Mouse", 2);
            bookings[5] = new Booking("B003", "Hi Five (Minus One)", 4);
        for (i=0; i<5; i++) {
            System.out.println("List of booking ID's and names:");
            System.out.println();
            System.out.println("Booking Number: " + (i+1) + "Booking made for: " + (i+1));
            bookings[i] = new Booking(bookingId, bookingName);
       }fixed that but still won't compile

  • ACK! Importing classes in JSP?!?! HELP!!!

    I am REALLY new to the JSP world and just finished creating a java applet that creates a graph and two combo boxes containing information that I need to display on a web page.
    The problem is that I have just been told to convert it to JSP? Is this possible? If it IS possible, how do you import a public class into JSP?
    Thanks sooooo much for your help!!!!!
    Adam

    Answer is yes you can import a java class
    Here is how it works
    use the following
    <%@ page import="com.temp.YourClass*" %>
    Assuming that you classpath is set properly
    Thanks
    Sampath Thummati.

  • How to import API classes in JSP?

    hi,
    What is the syntax for importing Java API classes in JSP (like in .java files)?
    I've tried,
    <% import java.util.*; %>
    <%! import java.util.*; %>
    <%@ import java.util.*; %>
    <%@ page import java.util.*; %>
    ...all don't compile!
    Please help. Thanks very much!
    Gerald.

    <%@ page import="java.util.*" %>
    Look at these resources:
    http://java.sun.com/products/jsp/pdf/card11.pdf
    http://java.sun.com/products/jsp/pdf/syntaxref.pdf

  • Unable to compile class for JSP--- help me plz!!!!!

    hi friends;
    Pease suggest me where i am wrong, i think javabean is not instantiated in jsp file.may be it is related to the classpath of javabean. i have not set any variable for javabean classpath. and i put javabean class file in
    TOMCAT_HOME/webapps/test3/WEB-INF/UseDta.class
    and all the jsp and html in /test3. my jsp an javabeans are--
    1. GetName.html
    <HTML>
    <BODY>
    <FORM METHOD=POST ACTION="SaveName.jsp">
    What's your name? <INPUT TYPE=TEXT NAME=username SIZE=20><BR>
    What's your e-mail address? <INPUT TYPE=TEXT NAME=email SIZE=20><BR>
    What's your age? <INPUT TYPE=TEXT NAME=age SIZE=4>
    <P><INPUT TYPE=SUBMIT>
    </FORM>
    </BODY>
    </HTML>
    2. SaveName.jsp
    <jsp:useBean id="user" class="UserData" scope="session">
    <jsp:setProperty name="user" property="*"/>
    </jsp:useBean>
    <HTML>
    <BODY>
    Continue
    </BODY>
    </HTML>
    3. UserData.java
    public class UserData {
    String username;
    String email;
    int age;
    public UserData(){}
    public void setUsername( String value )
    username = value;
    public void setEmail( String value )
    email = value;
    public void setAge( int value )
    age = value;
    public String getUsername() { return username; }
    public String getEmail() { return email; }
    public int getAge() { return age; }
    4. NextPage.jsp
    <jsp:useBean id="user" class="UserData" scope="session"/>
    <HTML>
    <BODY>
    You entered<BR>
    Name: <%= user.getUsername() %><BR>
    Email: <%= user.getEmail() %><BR>
    Age: <%= user.getAge() %><BR>
    </BODY>
    </HTML>
    url: http://localhost:8080/test3/GetName.html
    is it related to context path??
    HTTP Status 500 -
    type Exception report
    message
    description The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    org.apache.jasper.JasperException: Unable to compile class for JSP
    An error occurred at line: 2 in the jsp file: /SaveName.jsp
    Generated servlet error:
    C:\Program Files\Apache Software Foundation\Tomcat 5.0\work\Catalina\localhost\test3\org\apache\jsp\SaveName_jsp.java:44: cannot find symbol
    symbol : class UserData
    location: class org.apache.jsp.SaveName_jsp
    UserData user = null;
    ^
    An error occurred at line: 2 in the jsp file: /SaveName.jsp
    Generated servlet error:
    C:\Program Files\Apache Software Foundation\Tomcat 5.0\work\Catalina\localhost\test3\org\apache\jsp\SaveName_jsp.java:46: cannot find symbol
    symbol : class UserData
    location: class org.apache.jsp.SaveName_jsp
    user = (UserData) jspxpage_context.getAttribute("user", PageContext.SESSION_SCOPE);
    ^
    An error occurred at line: 2 in the jsp file: /SaveName.jsp
    Generated servlet error:
    C:\Program Files\Apache Software Foundation\Tomcat 5.0\work\Catalina\localhost\test3\org\apache\jsp\SaveName_jsp.java:48: cannot find symbol
    symbol : class UserData
    location: class org.apache.jsp.SaveName_jsp
    user = new UserData();
    ^
    3 errors
    org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:84)
    org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:332)
    org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:437)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:497)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:476)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:464)
    org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:511)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:295)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    note The full stack trace of the root cause is available in the Apache Tomcat/5.0.30 logs.
    Apache Tomcat/5.0.30
    please Reply me ASAP
    i'll be glad if you reply. please

    I am using Tomcat 6.0.
    I have put my UserData class in user package and
    used in below jsp(SaveName.jsp)
    <%@ page import="user.UserData" %>
    <jsp:useBean id="user" class="user.UserData" scope="session"/>
    <jsp:setProperty name="user" property="*"/>
    <HTML>
    <BODY>
    Continue
    </BODY>
    </HTML>
    I have already set my classpath as C:\Documents and Settings\user\My Documents\Java\apache-tomcat-6.0.16\apache-tomcat-6.0.16\webapps\ROOT\WEB-INF\classes;
    UserData class is in C:\Documents and Settings\user\My Documents\Java\apache-tomcat-6.0.16\apache-tomcat-6.0.16\webapps\ROOT\WEB-INF\classes\user
    My UserData class is
    package user;
    public class UserData {
    String username;
    String email;
    int age;
         public UserData(){
              this("","",0);
              System.out.println("najn thanne puli");
         public UserData(String username,String email,int age){
              this.username=username;
              this.email=email;
              this.age=age;
    public void setUsername( String value )
    username = value;
    public void setEmail( String value )
    email = value;
    public void setAge( int value )
    age = value;
    public String getUsername() { return username; }
    public String getEmail() { return email; }
    public int getAge() { return age; }
    But running SaveName.jsp shows exception
    org.apache.jasper.JasperException: /SaveName.jsp(2,0) The value for the useBean class attribute user.UserData is invalid.
         org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40)
         org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
         org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:148)
         org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1200)
         org.apache.jasper.compiler.Node$UseBean.accept(Node.java:1160)
         org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2343)
         org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2393)
         org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2399)
         org.apache.jasper.compiler.Node$Root.accept(Node.java:489)
         org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2343)
         org.apache.jasper.compiler.Generator.generate(Generator.java:3372)
         org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:198)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:314)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:294)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:281)
         org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:566)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:337)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    Please help me.thanks in advance.

Maybe you are looking for