Two Laptop Bag*
The moose likes Servlets and the fly likes Why HttpServlet also implements Serializable? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Why HttpServlet also implements Serializable?" Watch "Why HttpServlet also implements Serializable?" New topic
Author

Why HttpServlet also implements Serializable?

Kousik Majumder
Ranch Hand

Joined: Sep 30, 2007
Posts: 229
Hi all,

As we know that if any of the super class implements an interface then the descending classes need not use to implement the interface.

So why HttpServlet implements Serializable interface where as it extends GenericServlet and GenericServlet implements Serializable ?




Thanks,

Kousik
SCJP 5


Thanks in Advance,
Kousik
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19653
    
  18

Probably just clarity. It makes no difference to remove it, but this way they're saying "please note that this class really is serializable".


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

By making the servlet serializable, the builders of the servlet API insure that the implementers have the option of serializing the servlet for persistence or load balancing.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
 
 
subject: Why HttpServlet also implements Serializable?
 
Similar Threads
Why HttpServlet implements Serializable interface
GenericServlet Vs HttpServlet
HttpServlet Basic question
Where does ServletContect come in the hierarchy ?
extending a class which implements Serializable