It's not a secret anymore!
The moose likes Beginning Java and the fly likes normal class and java Bean Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "normal class and java Bean" Watch "normal class and java Bean" New topic

normal class and java Bean

Yeshwantrao Patil

Joined: Dec 05, 2004
Posts: 9
Hi frendz,

what is difference between normal class and java bean ? in jsp UseBean tag we can use only bean or both normal class and javabean ?..if we use both then whatz difference?

Thanx in advance
David Ulicny
Ranch Hand

Joined: Aug 04, 2004
Posts: 724
Basic difference is in constructor, bean must have public non parametric constructor, otherwise you will not be able to use jsp:useBean.

SCJP<br />SCWCD <br />ICSD(286)<br />MCP 70-216
Yeshwantrao Patil

Joined: Dec 05, 2004
Posts: 9
Thanx David Ulicny
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63858

Moved to Java in General (beginner).

[Asking smart questions] [About Bear] [Books by Bear]
Layne Lund
Ranch Hand

Joined: Dec 06, 2001
Posts: 3061
The other difference is with method names and conventions. Typically a Java Bean has properties. These properties are defined with getter and setter methods. For example, if you want to have a String property named foobar, then you need methods getFoobar() and setFoobar(String). The setter is optional if you want a read-only property.

Java Beans also allow for events and more complex property interactions. If you want more details, follow the link in my sig to the Java Tutorial and look for the trail about Java Beans.


Java API Documentation
The Java Tutorial
I agree. Here's the link:
subject: normal class and java Bean
It's not a secret anymore!