Difference b/w Java Class and Bean class

hi,
can anybody please tell me the clear difference between ordinary java class and java Bean class. i know that bean is also a java class but i donno the exact difference between the both.
can anybody please do help me in understanding the concept behind the bean class.
Thank u in advance.
Regards,
Fazlina

While researching this question, I came across this answer by Kim Fowler. I think it explains it better than any other answer I have seen in the forum.
Many thanks Kim
Hi
Luckily in the java world the definition of components is a little
less severe than when using COM (I also have, and still occasionaly
do, worked in the COM world)
Firstly there are two definitions that need to be clarified and
separated: JavaBean and EnterpriseJavaBean (EJB)
EJB are the high end, enterprise level, support for distributed
component architectures. They are roughly equivalent to the use of MTS
components in the COM/ COM+ world. They can only run within an EJB
server and provide support, via the server, for functionality such as
object pooling, scalability, security, transactions etc. In order to
hook into this ability EJB have sets of interfaces that they are
required to support
JavaBeans are standard Java Classes that follow a set of rules:
a) Hava a public, no argument constructor
b) follow a naming patterns such that all accessor and modifier
functions begin with set/ get or is, e.g.
public void setAge( int x)
public int getAge()
The system can then use a mechanism known as 'reflection/
introspection' to determine the properties of a JavaBean, literally
interacting with the class file to find its method and constructor
signatures, in the example above the JavaBean would end with a single
property named 'age' and of type 'int' The system simply drops the
'set' 'get' or 'is' prefix, switches the first letter to lower case
and deduces the property type via the method definition.
Event support is handled in a similar manner, the system looks for
methods similar to
addFredListener(...)
addXXXListener
means the JavaBean supports Fred and XXX events, this information is
particularly useful for Visual builder tools
In addition there is the abiliity to define a "BeanInfo' class that
explicitly defines the above information giving the capability to hide
methods, change names etc. this can also be used in the case where you
cannot, for one reason or another, use the naming patterns.
Finally the JavaBean can optionally - though usually does - support
the Serializable interface to allow persistence of state.
As well as standard application programming, JavaBeans are regularly
used in the interaction between Servlets and JSP giving the java
developer the ability to ceate ojbect using standard java whilst the
JSP developer can potentially use JSP markup tags to interact in a
more property based mechanism. EJB are heaviliy used in Enterprise
application to allow the robust distribution of process
HTH.
Kim

Similar Messages

  • Difference between a java program and a java class

    Hi there,
    What is the difference between a java program and a java class?

    HI,
    A java class is an object - described in a .class file - which has been given properties and behaviours and which can be instantiated in a program.
    A java program( application ) consists of at least one class (one of which must be declared public) and which executes its main() method ( of the public class ) when it is started.
    Every program is a class but not every class is a program.
    Examples:
    A java program
    // this simple program will print out the first command line argument you put
    // in after calling : java ScreenWriter "arguments"
    class ScreenWriter
    public static void main( String [] args )
    if( args.length > 0 )
    System.out.println( args[0] );
    A java class
    //the Math class is already defined in the java.lang package
    //and contains a constant for PI
    //So I can include the Math class with the PI constant in my simple program
    //and now I have a program that involves my ScreenWriter class and the Math class too.
    class ScreenWriter
    public static void main( String [] args )
    if( args.length > 0 )
    System.out.println( args[0] );
    System.out.println( "The value of Pi is: " + Math.PI );
    When you see package and import declarations at the start of a program they are there to ensure the compiler knows which classes are used in the program.
    Hope that helps,
    Terry

  • Problem importing classes and beans

    Hey there. Im having one major fustrating problem! When I code supporting classes and beans for my JSPs I get a code 500 internal server error when trying to import (via <%@ page import="class" %> and <jsp:useBean/>) Im storing my classes and beans in the WEB-INF folder and the calling JSPs are located in /ROOT/tests/8/jsp.jsp. Im using the following to import a class or bean:
    <%@ import="aClass" %>
    Seen as tho its in the WEB-INF folder I won't have to explicitly refer to where the class is located, just the class name.
    I never had this problem when I was using my hosting service. Its only on my localhost server in which I get the Internal Server error.
    Help appreciated, thx.
    PS: Im quite new to JSP/Java Servlet.

    import (via <%@ page import="class" %> and
    <jsp:useBean/>) Im storing my classes and beans in the
    WEB-INF folder try put your class file in WEB-INF/classes.
    or first put bean in the package, like WEB-INF/classes/packagename/beanclass
    in jsp page:
    <jsp:useBean id="Mybean" class="packagename.beanclass" scope="request" />
    Question: is /ROOT a context entry in your server.xml?
    Which JSP Container (version) you use? Maybe your localhost server's set up is different with your hosting.

  • What is the difference between document class and normal class

    Hi,
    Please let me know what is the difference between document class and normal class.
    And I have no idea which class should call as document class or call as an object.
    Thanks
    -Actionscript Developer

    the document class is invoked immediately when your swf opens.  the document class must subclass the sprite or movieclip class.
    all other classes are invoked explicitly with code and need not subclass any other class.

  • Difference between Data Class and Delivery Class

    What is the Difference between Data Class and Delivery Class , what happens Phisically to the Data .
    Moderator message: what is the difference between your question and a question that we'd welcome here in the forums?
    [Rules of engagement|http://wiki.sdn.sap.com/wiki/display/HOME/RulesofEngagement]
    Edited by: Thomas Zloch on Nov 22, 2010 1:17 PM

    What is the Difference between Data Class and Delivery Class , what happens Phisically to the Data .
    Moderator message: what is the difference between your question and a question that we'd welcome here in the forums?
    [Rules of engagement|http://wiki.sdn.sap.com/wiki/display/HOME/RulesofEngagement]
    Edited by: Thomas Zloch on Nov 22, 2010 1:17 PM

  • Difference between Material Class and Batch Class

    Hi!
    What is the difference between Material Class and Batch Class?
    and how can we use these classes?
    Rgds,
    Ajit

    Iam not sure but i think
    1) Material class for sorting purpose
    2) Batch Class for Batch Management
    thanks
    K.Prabakaran

  • What is the relation between main class and inner classes

    hi
    i want to make a UML design and o want to know how to draw the relation betwwen the main public class and inner classes?
    and what is the relation?

    BaffyOfDaffyA wrote:
    Please keep in mind that if you spell better you will get better answers and if you add duke stars you will get better answers and if you mark the thread as a question you will get better answers. That will make it look like you are paying attention and that you really want an answer.
    My best answer based on your rather vague question:
    A minimal public class in a file named "Minimal.java" in the directory named "minimal":
    package minimal;
    public class Minimal {
    private int variable;
    public Minimal(int var) {
    variable = var;
    public int getVariable() {
    return variable;
    }This would be an example of adding an inner class:
    package minimal;
    public class Minimal {
    private int variable;
    public Minimal(int var) {
    variable = var;
    public int getVariable() {
    return variable;
    public class Inner {
    private int innerVariable;
    public Inner(int var) {
    innerVariable = var;
    public int getInnerVariable() {
    return innerVariable;
    }The inner class is exactly like any other inner class except if you are accessing it from anything else other than Minimal then you would have to add Minimal. right before Inner for example, where the Minimal class could use
    Inner inner = new Inner(5);other classes would have to use
    Minimal.Inner inner = new Minimal.Inner(5);
    See [Inner Class Example|http://java.sun.com/docs/books/tutorial/java/javaOO/innerclasses.html] or [Nested Classes|http://java.sun.com/docs/books/tutorial/java/javaOO/nested.html] for more information.
    He is probably not asking what an inner class is or how to declare one in raw source code. To me he is asking how do I
    explain this relationship in a UML diagram and as UML is not and exact science and expression can vary a lot
    between UML design applications I didn't want to stab in the dark.
    @OP I would say whatever seems most logical to you and your team, write something that reads.

  • LinkedList class and ArrayList class

    Hi everyone,
    What is difference between LinkedList class and ArrayList class ??

    Hi samue!
    If you had typed that question you would have got many answers.anyway
    difference between Linked List and ArrayList
    1.In linked list each element is stored as an object but not in arraylist
    2.Linked list need iterator to go through its contents but not arraylist
    3.reading element from each takes same time but if you want to add or remove element from the arraylist it takes considerable amount of time depending on the index number. in Linkedlist case it takes constant amount of time to add/remove at any index.
    this should be enough guess to know the difference but if u need try goooogle

  • Singleton pattern class and static class

    Hi,
    what is difference between the singleton pattern class and static class ?
    in singleton pattern, we declare a static member[which hold one value at a time] ,static method[ which return static member value] and a private constructor[not allow to direct instantiation]. My words are -- as a singleton pattern we implement static class .
    so can we say a singleton pattern is static class it means both are same or is any difference between these two ??

    malcolmmc wrote:
    On several occasions I've had to convert a static (never instanceated) class to a singleton type, for example because I realise I need an instance per thread, or I decide to make a program more modular, with more than one configuration.
    I've never done the opposite.
    So generally I favour the singleton if there any "state" involved, because it's more flexible in unanticipated directions. It also gives extra flexibility when building tests, especially if you program to an interface.Total agreement; if anything it is dead hard to override static method logic with mock code in unit tests (I had to do it by keeping the static methods in place but making them internally use a singleton instance of itself of which the instance variable could be overwritten with a mock implementation for unit testing purposes...).
    'Static classes' and/or methods are great for very simple util functions, but I wouldn't use them for anything other than that.

  • Owner Class and Base Class ?

    hi,
    What is an Owner class and base class?
    thanks,
    Hanu

    Hi,
    the question is related to oracle java class or samething else?
    I dont understand your question.
    Regards,
    Tom

  • Data class and Delivery class in ABAP Dictionary

    Hi all,
    I want to know the exact information about Data class and Delivery class in ABAP Dictionary
    Moderator message : Search for available information. Thread locked.
    Edited by: Vinod Kumar on Aug 3, 2011 1:35 PM

    As your name Suggests, there were exactly 21 rajapandian already who wanted exact information about  Data class and Delivery class. Fortunately some has found the information by own and some were dumped by SAP Police.
    Cheers
    Amit

  • Tables for development class and Message Class

    Hi All,
    In which table is Message Class and Development class stored.
    Thanks,
    Santosh

    Hi All,
    I am closing this thread..I was looking for a single table which does this and it is TADIR with object = MSAG
    Thanks,
    Santosh
    Edited by: Santosh Kumar KezkhepatMelathil on Aug 29, 2008 1:32 PM

  • Data class and storage class

    Hi ,
    I need some info or docs on data class and stroge class of DSO /cube.
    Regards
    tapashi

    Hi Tapashi,
    Something i found about dataclass in DSO/Cube, which might be useful to you.
    Within SAP BW following data class of DDIC objects are important:
    DDIM           Dimension Tables in BW of InfoCubes
    DFACT          Facts Table in BW of InfoCubes
    DODS           ODS Tables in BW
    These have been introduced in order to improve performance while reading/writing InfoProviders. Settings of data class are maintained in "Technical Settings -> Database storage parameters" screen of TA SE11. Data class is assigned to the database tables of the InfoCube (table RSDCUBE, RSDODSO). Notice that this assignment cannot be made by any circumstances by user, only system does this while you activate InfoProvider.
    Subsequently see overview of table RSDCUBEu2019s fields with link to data class according BW versions:
    SAP BW 3.x (parameters only affect aggregates, not the cube):
    AGGRDATCLS     Data class for aggregate fact tables (only aggregates)
    AGGRSIZCAT     Size category for aggregate fact tables
    ADIMDATCLS     Data class for aggregate dimension tables
    ADIMSIZCAT     Size category for aggregate dimension tables
    Furthermore see overview of RSDODSOu2019s fields for DSO objects as InfoProvider with link to data class:
    ODSADATCLS     Data class for table with active data of the ODS
    ODSMDATCLS     Data class for table with ODS input data
    To see all available data classes check table: DDART (DD: Data Class in Technical Settings)
    To see all available size categories check table: DGKAT (DD: Size category in technical settings)
    Hope this is helpful.
    Regards
    Snehith

  • Processing classes , evaluation classes and cumulation classes

    Hi All ,
       Can anybody give the details of PCR in HR and how to use processing classes and evaluation classes in PCR.
    Regards ,
    Santosh.

    Hi,
    we have an operation VWTCL which checks the Processing class and its specification in PCR.
    go to T.Code: PE04 and check the operations documentation you will get clarity.
    Operation VWTCL VV reads the specification of processing class VV for the current wage type in table T512W, and enters this as a single-character entry in the variable argument of the personnel calculation rule. Function VWTCL is a decision operation.
    for example:
    X010 Determination of valuation bases INTERNATIONAL
            VWTCL 01   Processing class
                ERROR      Cancel processing
              0
                ADDWT *    OT   Output table
        1
            VWTCL 01   Processing class
              0
              1
                ADDWT *    OT   Output table
                ELIMI Z    Elim.time period ID
    Regards,
    mohammed

  • What are exception class and persistant class?

    hi,
    what are exception class and persistant class?
    how are they different from the normal class?
    Regards,
    Anil

    Hii!
      Persistent Classes
    To use the Persistence Service for objects, the classes of these objects must be created as persistent classes in the Class Builder. The term persistent class does not imply that a class is persistent. (As a template for objects, every class is persistent). Rather, it means that the objects of that class and their state are managed by the Persistence Service. For example, the objects of these classes are instantiated in the ABAP program with a method of the Persistence Service, which ensures that the initialization is correct (not with the usual CREATE OBJECT statement). When the Class Builder creates a persistent class, it automatically generates an associated class, known as the class actor or class agent, whose methods manage the objects of persistent classes. As well as their identity, persistent classes can contain key attributes, which allow the Persistence Service to ensure that the content of each persistent object is unique.
      Check out this link
    http://www.sapnet.ru/abap_docu/ABENABAP_EXCEPTION_CLASSES.htm
    Regards
    Abhijeet

Maybe you are looking for

  • Is the battery built-in or easily removed?

    I just wanted to know whether the new macbook follows the design of the airbook in this respect. I prefer to have more than one battery ready for use, is the need arise

  • Fire Wire 800?

    I have an external firewire drive plugged into the standard fw400 port on my Mac. If I get the right cable, can I plug the same drive in the 800 port and get faster transfers? Or do I need a different drive altogether. Thanks Noah

  • Problem in Transaction CL24N

    Hi All When i want to configure value for release strategy using transaction CL24N and click only new assignment button it ask 2 option class and  release strategy by selection second option it comes to second screen. In this screen when is press rel

  • Select statement: LIKE IN?

    I have this SQL statement that I want to select as follows: select * from customer where cust_desc like in (select partnumber from orders ) I hit an error doing this. How should I requery my sql statement? Please note: I retrieve 10 records when I di

  • Urgent...problem in  manuall ale config

    hi all, when iam doing ale config for a a simple vendor master data transfer i got error. the first 3 steps r ok. rfc destination and test connection and remote logon is ok. in step 4 ..i assigned a message type(cremas) to the modelview.when i expand