AntoniRyszard
asked on
Question about Servlet example?
Hello,
My wrox java server pages text, includes an example where some user data is posted to servlet.
To process the data posted and store this, they created a interface class and another class AdminManager which implements the interface.
In the servlet they created an object from the interface class, and called the AdminManager methods through the interface object.
In the book this was the only example which used a interface. And I wondered if this design approach was often used, or should an interface normally be used if several classes would implement the interface.
Thanks
My wrox java server pages text, includes an example where some user data is posted to servlet.
To process the data posted and store this, they created a interface class and another class AdminManager which implements the interface.
In the servlet they created an object from the interface class, and called the AdminManager methods through the interface object.
In the book this was the only example which used a interface. And I wondered if this design approach was often used, or should an interface normally be used if several classes would implement the interface.
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Using the interface is a good java design practice?
I was thinking we could alternatively, write a class which includes methods to process and store the servlet data. And we call the constructor of this class in the servlet. And the classes other methods through the constructor.
Have you possibly seen any examples where the use an interface class, a class which implemented the interface and a servlet was used?