473,378 Members | 1,417 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Hi what can you say about Java Beans...

jeffbroodwar
118 100+
Hi Guys,

I just want to hear your understanding of Java Beans. I mean it doesn't just expose properties (for parameters) right? Java beans must be able to do what variables can't. i need feedbacks please. Thanks

Regards,
Jeff
Jul 4 '07 #1
4 1854
JosAH
11,448 Expert 8TB
Hi Guys,

I just want to hear your understanding of Java Beans. I mean it doesn't just expose properties (for parameters) right? Java beans must be able to do what variables can't. i need feedbacks please. Thanks

Regards,
Jeff
There's not much to say about beans; any POJO (Plain Old Java Object) can
be a bean; according to Sun:

Definition:

A Java Bean is a reusable software component that can be visually manipulated in builder tools.

To understand the precise meaning of this definition of a Bean, clarification is required for the following terms:

Software component
Builder tool
Visual manipulation
Note that it isn't required to be visually manipulatable, nor does one need a
builder tool. There's one badly understood aspect about beans: for a property
'T x' in order to be manipulatable there need to be methods available named:

Expand|Select|Wrap|Line Numbers
  1. private T x;
  2. public T getX() { return x; }
  3. public void setX(T x) { this.x= x; }
  4.  
People think that those get and set methods must operate on private member
variables which isn't true; a property is just a property, i.e. it doesn't have to be
a member variable. The above example is bad practice: simply making 'x' a
public member variable has the same effect.

kind regards,

Jos
Jul 4 '07 #2
praveen2gupta
201 100+
Hi Guys,

I just want to hear your understanding of Java Beans. I mean it doesn't just expose properties (for parameters) right? Java beans must be able to do what variables can't. i need feedbacks please. Thanks

Regards,
Jeff

Hi
I uses and Understands java Beans as follows.

1. Whenever I need the a java class in the JSP page. I can store that class in the WEB-INF folder and I can call this class by a bean name

Syntex: <jsp:useBean id="LearnJava" class="class name " scope = "page" />


2. I finds that some java method of the class is required in the JSP page I can call that method by the bean name followed by the method name.

Example:
BeanId.MethodName
LearnJava.methodName


3. When ever I need the parameters to be passed to the methods of the class file We can use get and set properties.
Jul 4 '07 #3
jeffbroodwar
118 100+
Hi,

Thanks for sharing your thoughts.... i was just thinking about variables vs. beans. Hmm... basically, beans can be used as a library. You can keep different beans having different properties for later use.(depending on the task to be handled). Can you guys give me a sample of how can i use java beans as an object that will be used to bind a jComboBox to the database? just get the values in one of the fields in the database will be fine. Cause i saw other IDEs in Java that supports database binding. (I'm using netbeans) Netbeans will have this feature in the last quarter of 2007 (in their release of Netbeans 6.0). Thanks.

Best Regards,
Jeff
Jul 5 '07 #4
JosAH
11,448 Expert 8TB
Hi,

Thanks for sharing your thoughts.... i was just thinking about variables vs. beans. Hmm... basically, beans can be used as a library. You can keep different beans having different properties for later use.(depending on the task to be handled). Can you guys give me a sample of how can i use java beans as an object that will be used to bind a jComboBox to the database? just get the values in one of the fields in the database will be fine. Cause i saw other IDEs in Java that supports database binding. (I'm using netbeans) Netbeans will have this feature in the last quarter of 2007 (in their release of Netbeans 6.0). Thanks.

Best Regards,
Jeff
It's not the IDE that supports what you want: there are vendor specific beans that
do that for you. Notably Borland likes those 'data aware' widgets/components,
or whatchamacallit. I personally keep visual beans/components and data
handling beans/components as far apart from each other as possible.

Use beans for the Model, i.e. beans that can manipulate data, use beans for
the View, i.e. beans that are as stupid as they come but are very good at
displaying stuff and think of Controller beans: the beans that implement your
business logic (read: what you actually want to do).

kind regards,

Jos
Jul 5 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Tushar | last post by:
Hello, I am working on a client server application involving TOMCAT as Web server, MySQl as the DB and combination of JSP, Servlet, and JavaBeans to access and write Data back. There is...
0
by: James Hong | last post by:
Help please, I try to sending an email from my html page using the java applet. but it give error on most of the PC only very few work, what is the error i make the java applet show as below ...
3
by: Francis M | last post by:
Nowadays when you obtain the SDK form java.com you get a new interactive programming environemt much like the Borland C++ IDE. Up to now I've been developing applications "the old way" using...
0
by: donnet | last post by:
To those familiar with Java beans, question on how to do with ASP.NET: I come from J2EE and starting to learn ASP.NET and C#. I want to find a way to display a web form filled with data taken...
9
by: Stephen H. | last post by:
Hi, I have an existing web application with java beans that I wanne migrate to ASP.NET using C#. The existing web application has some jsp files that use java beans as follows: .... <%@...
1
by: Andrea Temporin | last post by:
Is there someone who can tell me if it's possible to call Java Beans from Visual Basic Applications (windows forms application I mean)? Can I Use J#? Is It possible to create a Java web services as...
7
by: Christian Wilhelm | last post by:
Hi! I'm trying to call a Java WebService out of a .net Client. There are two Methods, one Method requires one Parameter of type Parameter, the other Method requires one Parameter of type...
2
by: Jobs | last post by:
Download the JAVA , .NET and SQL Server interview with answers Download the JAVA , .NET and SQL Server interview sheet and rate yourself. This will help you judge yourself are you really worth of...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.