Where I should put the bean class?

Hello,
I am learning JSP. I want to know where I should put the bean class? Which directory should I put the bean class?
note that I am using Tomcat 4.1
johnwen
24-12-2005

I can't tell if you've got everything you need or not, but what you've shown looks right so far. Let me run down the necessities:
In your JSP file:
<%@ page import="aos.*" %>
<%-- imports all of the classes in the "aos" package --%>
In your Java file:
package aos; // tells Java this is a package (you probably have this)
Then, of course, you put the class file into the directories that you mentioned, ie, $CATALINA_HOME/ROOT/WEB-INF/classes/aos (forgive me if I use Unix-styled slashes; old habit, and shouldn't make any difference.)
You may need to restart Tomcat. You have to restart it when you add certain directories, although I'm not sure exactly which ones. But it never hurts to just restart it anyway.

Similar Messages

  • Where to put the Bean class in a html- Bean- JSP setup

    Hi,
    The setup is simple, the front end is a html form, there is a Java Bean with set/get methods and finally a jsp which accesses the bean and prints the result.
    The problem is that it cannot locate the Bean class. I have compiled the bean class and stored the .class file in webapps/ROOT/WEB-INF/classes dir. The jsp and html files are located in the webapps/ROOT dir. Iam using tomcat 5.0.28, with ROOT context enabled. Is this because I need to set the CLASSPATH for Tomcat? Any pointers?
    Thanks

    No you don't need to set CLASSPATH.
    You need to put your bean in a package.
    As of java1.4, JSPs can not access beans that are in the default/unnamed pacakge.
    package mypackage
    public class MyClass
    and then the class would compile to
    WEB-INF/classes/mypackage/MyClass.class

  • TS1702 i have an issues everytime i put my apple id and password to face time and imessage he said verifying and he goes back to where u should put ur password and wont check mark the mail and i create a new apple id the same what should i do ?

    i have an issues everytime i put my apple id and password to face time and imessage he said verifying and he goes back to where u should put ur password and wont check mark the mail and i create a new apple id the same what should i do ?

    i have an issues everytime i put my apple id and password to face time and imessage he said verifying and he goes back to where u should put ur password and wont check mark the mail and i create a new apple id the same what should i do ?

  • A question about variables and where I should put them!

    Hi, I'm fairly new to java. I'm a first year computer scientist and I'm struggling with where I should put my variables.
    So far on the course I've been able to wing it as we have not been doing object orientated programming, it was more like programming in fortran!
    Anyway if you look at the code below, I need the variables 'speed', 'distance', 'time' and 'tottime', to be calculated in my seperate methods, but then called in my main part to be printed out; however I have no idea where I put them to get this to work!
    The program is by no means complete, it's still a work-in-progress, but I need to get this sorted before I continue.
    Thanks in advance
    /////  LogName: gxm07u
    /////  FullName:
    /////  CreationDate: 2007-11-07 09:30:07
    import java.io.*;
    public class travel {
        public static void printMenu()
             System.out.println("Travel Program\n\nn: Enter a journey\ns: Get complete journey stats\nd: Get Distance travelled stats\nq: quit");
        public static void RoadMenu()
             System.out.println("Type the road type:\nType m: Motorway\nType a: A road\nType b: B road\nType u: Urban road");
        public static void enterRoadType()
             char choice;
             choice = UserInput.readChar();
             switch(choice)
                  case 'm': //motorway
                  case 'M':
                       speed = 85;
                  break;
                  case 'a': // a road
                  case 'A':
                       speed = 70;
                  break;
                  case 'b': //b road
                  case 'B':
                       speed = 55;
                  break;
                  case 'u': // Urban road
                  case 'U':                                     
                       speed = 40;
                  break;     
        public static void enterDistance()
             System.out.println("Type the travel distance: ");
             distance = UserInput.readDouble();
        public static void calcTime()
             time = speed/distance; // time in hours
             tottime = tottime + time; //total time in hours         
        public static void main(String[] argv) {
              int speed = 0;
              double distance = 0;
              double time=0, tottime=0;
         } // end of main
    } // end class

    Your calcTime() can't see variables local to other methods you either need to make them global or pass them in as parameters. To make them global:
    public class travel {
         int speed = 0;
         double distance = 0;
         double time=0, tottime=0;
        public static void printMenu()also you're main method should create a instance of the class
        public static void main(String[] argv) {
    new travel();
    }BTW it's convention to make class names begin with a uppercase letter. Also, look at using the equalsIgnoreCase() for your switch statement as it could save you 4 cases.
    Hope this helps

  • Is it possible to put the java classes of an application and run?

    Hi All,
    Please excuse me if this question seems meaningless / laughable.
    We get java class files by compiling the source code with java compiler. To run the application, classpath can be set to the folder where the class files are stored and then run the main class.
    Now the question is, is it possible to read the class files to RAM and then run the application. I highly appreciate your help.
    Thanks in advance.
    Chinnaswamy

    You could
    1.) copy the class files to a ramdisk
    2.) write another class loader that deletes the class files after loading >them from ram
    but all of this is probably not necessary.
    What exactly would you like to achieve by doing this? Thanks, JoachimSauer.
    The idea I have in mind is to first read and store the java class files in C/C++ code and then while running the C/C++ code, read & put the java classes into RAM and run the java application.
    This way the decompilation problem can be alleviated for valuable java applications. ( I am not sure, this will work)
    Another reason could be speed improvement. Classes in RAM is expected to make the application to run faster than when class files are in hadr disk
    With regards
    Chinnaswamy

  • Where Do You Put The Un-Ziped Files For...

    The manual is unclear.
    Where Do You Put The Un-Ziped Files for Contact Sheet X in CS4.

    CSX v1.4.2 README
    INSTALLATION:
    If there are previous versions of CSX, be sure to remove them at
    this time. Failure to do so may result in 'Copy' errors during installation.
    Unzip the CSX zip file into a temporary directory. It's location is
    unimportant EXCEPT DO NOT unzip it anywhere your Photoshop application tree.
    Run the InstallCSX script in the top-level directory. You can do this by:
    1) double clicking it
    2) dragging it onto a PS application
    3) running it from inside PS via File->Scripts->Browse
    If your OS is Vista, you will probably need to start Photoshop using
    'Run as administrator' because the installation script needs to install
    CSX into Photoshop folders that are normally protected.
    If you have more than one installation of Photoshop on your computer, you'll
    need to run the installation script for each copy of Photoshop.
    When the installation is complete, you can removed the contents that you
    unzipped before.
    MANUAL INSTALLATION:
    You don't need to do this if you ran the InstallCSX script.
    If there are previous versions of this script, be sure to remove them at
    this time.
    Unzip the distrubution file in your Photoshop Presets/Scripts directory and
    restart Photoshop. "CSX-1_4_2.jsx" should appear in your File->Scripts menu
    in CS2.
    With CS3 and CS4, CSX should appear under File->Automate menu as
    'Contact Sheet X v1.4.2...'.

  • Printing directly from the bean class

    i am using a 3 tier layer to implement an event calendar
    i have a calendar.jsp that sends form data to eventday.jsp, which extracts the form data and calls mtds from eventBean.java that connects to db. my print statements are in the bean class. my prob is that the required information are not printed.
    i have debugged calendar.jsp and eventday.jsp and am quite sure that both are ok. i have placed a simple print statement in the bean class n it does not get printed.
    can i know if it's true we can't print directly from the bean class?
    should i return the values to be printed in dayevent.jsp instead?

    i see, then will it be okay if i store the value retrieved from the bean in a vector n retrieve the vector content in the jsp page? but i remember my tutor sayin that it's poor programing to expose the data structure to other classes or pages? wat other mtd can i use then? thks!

  • My ipod is broken in where you would put the usb cable into the ipod

    my ipod is broken in where you would put the usb cable into the ipod to charge it or to connect it to the laptop does anyone know if it can be fixed

    Any Apple store or an AASP will repair it for a fee!  If you want DIY instructions try the iPod Repair Tutorials and the YouTube "How To" tutorial websites. 

  • Java.lang.ClassCastException in the Bean Class

    Does anybody have any idea about the following exception.
    MessageLoggerBean is the Bean class and I am attaching the java file for further
    reference
    java.lang.ClassCastException: com.wellmanage.Bean.MessageLoggerBean_3p5ifg_HomeImpl
    java.lang.ClassCastException: com.wellmanage.Bean.MessageLoggerBean_3p5ifg_HomeImpl
    at com.wellmanage.Bean.MessageLoggerBean.getConnection(MessageLoggerBean.java:181)
    at com.wellmanage.Bean.MessageLoggerBean.logMessage(MessageLoggerBean.java:77)
    at com.wellmanage.Bean.MessageLoggerBean_3p5ifg_EOImpl.logMessage(MessageLoggerBean_3p5ifg_EOImpl
    java:79)
    Thanks
    Srini
    [MessageLoggerBean.java]

    Please configure the classloader to delegate to the parent loader by specifying the following in WEB-INF/sun-web.xml (the Sun ONE Application Server specific deployment descriptor for web applications)
    <class-loader delegate="true"/>
    More information on this can be found at
    http://docs.sun.com/source/816-7150-10/dwdeploy.html#48102
    Thanks,
    Arvind

  • I own the original (color photometer) EYE1 PHOTO. I use Windows 7; where do I put the printer profile?

    Where do I put the (original-color photometer) EYE1 printer profile in Windows 7?

    You could try to put it here:
    C:\Program Files\Common Files\Adobe\Color\Profiles
    Copying the color folder from your laptop? I don't know - it might work, but I would create a restore point beforehand,
    I'm no expert on Windows, so hopefully somebody more knowledgeable might be able to help you.

  • Where i can put my servlet class in tomcat 4.1

    where i can put my servlet class in tomcat 4.1 ?

    hi,
    you have to put your serlet class file in
    Tomcat\webapps\
    Here create a directory as you wish
    then, Tomcat\webapps\your directory\WEB-INF\classes
    and you have to copy web.xml to WEB-INF directoy.
    Hope this will help.
    Regards
    Sekhar

  • TS2662 Where do I put the disk in the computer

    Where do I put the disk in the computer

    A bit more info on what you want to do?
    What kind of disk is it and what do you want the computer to do with it?

  • Where does iphoto put the library?

    where does iphoto put the library?
    i thought it would be put in the pictures folder but at least in my case it is not there! the folder is empty.
    I can import pictures and they show in iphoto and frontrow but I would simply like to know where on my harddisk they end up.
    anybody?
    thanks

    Chris
    No! Don't make anew library it will overwrite your old one.
    It's there somewhere, it's just that it's visibility status has changed (why??)
    Anyway try the following:
    go to http://www.cocoatech.com and download Pathfinder. This is an alternative to the Finder - and it has extra features, among them a View-> Show Invisible Items command. This might help us find it.
    Pathfinder is shareware, but you can use it for a trial period without paying.
    Regards
    TD

  • HT4199 where do I put the micro sim for the iPad, dosent seem to be any where to insert the card

    Where do I put the micro sim for the iPad , I cant find any where to put the card.

    What model is your iPad? (iPad, iPad 2 or New iPad). Did you get the AT&T or Verizon model? If you got the Verizon model, it doesn't have a SIM slot.

  • Where i should put external java library so UDF can import directly ?

    Hi All,
    I have some scenario using UDF and this code required a lot of external jar file. Please
    advise me where i should put this JAR file so i can import directly from UDF without need to import using Import Archive ?
    Thank you and best Regards
    Fernand

    Hi,
    is there any other alternative rather than put in into import archive ? like i copy all ther Jar file into certain
    directory in XI server and restart ther server so automatically, i can import insite my UDF wihout import archive ?
    Thank you and Best Regards
    Fernand

Maybe you are looking for