Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Bean creation

 
Naveed Ali
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Happy new year friends!
I have some confusions about 'Bean' creation,
- To create a bean it is only required(essential) to import the Bean.* and then use this class like a bean.
- Above assumption is not true and we can use any class ( not importing Bean.* ) like a bean providing that class uses some setter and getter methods in the pattern of bean.
- Any bean used in JSP can be in turn a Servlet.
Which of the above arguments are true, explain? Any body.
thnx
Naveed
 
Michael Ernest
High Plains Drifter
Sheriff
Posts: 7292
Netbeans IDE VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Naveed -
There's nothing about a JavaBean that functionally separates it from any other Java class. What's important is that a bean includes certain signifiers -- such as getter/setter methods -- that allow the system to control a JavaBean object at the descriptive level of 'properties' and 'events.'
So yes, you can instance a JavaBean like a class, but only if you want to treat it like any other class. By indentifying it as a bean (for example, through the jsp:useBean tag), you get to take advantage of its additional descriptive features.
Finally, all JSP pages are ultimately a kind of servlet, so it stands to reason that beans function the same way in both.
Hope this helps,
 
Naveed Ali
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Michael!
Thanx for the reply, but still a piont that what is Bean.* for and in what situation we can use it?
Naveed.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic