my dog learned polymorphism*
The moose likes JSP and the fly likes Worker Beans and Serializable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Worker Beans and Serializable" Watch "Worker Beans and Serializable" New topic
Author

Worker Beans and Serializable

Eric Howell
Ranch Hand

Joined: Nov 26, 2000
Posts: 63
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

Joined: Mar 22, 2000
Posts: 12755
    
    5
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

Joined: Nov 26, 2000
Posts: 63
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Worker Beans and Serializable
 
Similar Threads
Clarification for a mock question in net..
Java beans + JDBC
JavaBeans vs EJB
what are java beans
Why Use JavaBeans?