Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Worker Beans and Serializable

 
Eric Howell
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think it is common practice to implement JavaBeans (eg worker beans etc) with the serializable interface. Some books etc sometimes give examples that don't.
Also the same applies to providing a no args constructor.
When just using JavaBeans in say a MVC design pattern what is the common or correct practice.
What is the advantage and what is the correct practice. This is a source of confusion to me.
I wonder is someone could put in their two cents or pence( any currency is OK )
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13061
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One possible reason for making any helper class serializable is that if you store an instance in a session, the servlet engine may be able to store the session out to disk to save memory.
Bill
[ March 06, 2002: Message edited by: William Brogden ]
 
Eric Howell
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for that Bill.
I get a little confused with definitions.
I wonder, how could we best define a 'worker bean'.
Would it be a bean used by the JSP to do a job eg displaying some info from the db or some connection etc. How would it differ in definition from another bean.
Also, could a bean called from a servlet (in an MVC type system) be defined as a worker bean.
Thanks in advance
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic