Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Doubt in using bean

 
veeramani velayutham
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When we go for bean and when we go for simple java class, which have only business logic
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13062
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As used in servlets and JSP, a JavaBean is just a Java class that follows certain naming and access conventions which let you take shortcuts in JSP page code. If you don't want to use those shortcuts, don't use bean conventions.
In any helper class - bean or non-bean - you just need to keep in mind the scope of the object as related to the multi-threaded nature of web applications.
Bill
 
gudla Dathathreya Reddy
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Beans are used especially when you want to hold some data and this data can be transmitted from business layer to presentation or database layer to business layer etc. Most cases to hold data use bean. At the same time beans are some type of Java classes with some convention rule such as it should have a constructor with zero arguments, data member and setter, getter methods.
When you come accross to use a java class it can be use for any activities apart from holding data.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64858
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Java beans are very important with respect to JSP since many of the JSP mechanisms, be they JSP actions that operate upon data or the new Expression Language (EL), expect data to be bean-patterned. Non-bean-patterned data just won't work well with these mechanisms.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic