Designing Java beans


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Designing Java beans

  1. #1
    Ramprasad Guest

    Designing Java beans


    Hi,
    I need to develop an application with following
    1)JSP
    2)Servlets
    3)Javabeans (not EJB)
    using Model, View, controller paradigm.

    I have several questions on my mind regarding the design of the application


    1) Should java beans to be used only for Visual components ?
    2) where do i have to put my core business data ? Should i have them as a
    attributes for a bean ?

    If you can give me some sort of guidelines on the above lines, or refer me
    to a web site that talks about this , it will be of great help to me

    Rgds

    Share on Google+

  2. #2
    Larne Pekowsky Guest

    Re: Designing Java beans

    Ramprasad <ssrik@yahoo.com> wrote:

    >1) Should java beans to be used only for Visual components ?


    Although much of the bean specification deals with how to manipulate
    beans in a visual editor, they can be used in many other ways.
    Really, beans can be used any time you can model some object or logic
    as a 'black box' with well-defined inputs and outputs.

    >2) where do i have to put my core business data ? Should i have them as a
    >attributes for a bean ?


    Absolutely! Let me give you a real-world example. The first thing a
    new user at CapitalThinking (www.capitalthinking.com) will typically
    do is describe a property for which they would like to obtain a
    mortgage, then they will describe the mortgage terms they would like,
    and we show them a list of lenders that match their criteria. We have
    a 'property' bean with get and set methods for things like the asset
    value and address. We have a bean for the loan terms. We also have a
    bean that actually performs the search, all the complex search logic
    is hidden in this bean, the application just needs to call
    getMatches() to obtain the results.

    >If you can give me some sort of guidelines on the above lines, or refer me
    >to a web site that talks about this , it will be of great help to me


    In broad terms:

    * Beans contain the business logic (the model)
    * JSPs display results from beans, and generate the forms that populate
    the beans (the view)
    * Servlets handle the interaction between the user and the view, such
    as authentication, setting up any beans that get created without
    direct user intervention, and so on (the controller).

    There is an article that discusses design patterns for enterprise
    applications at
    http://developer.java.sun.com/develo...DesignEntApps/

    This is more focused on J2EE, including EJB, but most of it applies
    equally well to regular Java beans.

    - Larne

    Share on Google+

Similar Threads

  1. Java vs. .Net. A questionnaire
    By Basil in forum .NET
    Replies: 1
    Last Post: 05-13-2005, 07:46 AM
  2. learning c# very confusing.
    By Mike Tsakiris in forum .NET
    Replies: 11
    Last Post: 10-04-2002, 06:32 PM
  3. Re: VB vs. Visual Age for Java
    By JJ in forum Enterprise
    Replies: 1
    Last Post: 07-06-2000, 05:50 AM
  4. Java Beans
    By Texas Ranger in forum Java
    Replies: 2
    Last Post: 06-28-2000, 12:17 PM
  5. Java Beans
    By Manoj in forum Java
    Replies: 2
    Last Post: 04-08-2000, 09:13 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center