Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Need for servlet serialization

 
Java Green
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why the servlets need to implement Serializable interface.
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Java Green"-
Welcome to the JavaRanch! Please adjust your displayed name to meet the

JavaRanch Naming Policy.

You can change it

here.

Thanks! and welcome to the JavaRanch!

Mark
 
Julian Kennedy
Ranch Hand
Posts: 823
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think this is a fairly FAQ. I would guess that the answer is that if Servlet didn't implement Serializable then it wouldn't be able to be serialized. It only needs to implement Serializable if it needs to be serialized. The question then becomes why would you need to serialize a Servlet. I don't know the answer to that and, perhaps, neither did the original developers. Maybe the decision was taken to implement Serializable in case some valid reason for serializing a Servlet materialized. After all, there are no obvious adverse effects of this implementation.

Jules
 
Peter den Haan
author
Ranch Hand
Posts: 3252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
See this thread for the answer.

- Peter
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic