Can you make polymorphic bean references?

When you write a <jsp:useBean>, the class attribute determines the class of the new object (if one is created). It also determines the type of the reference variable used in the generated servlet.

The way it is NOW in the JSP

image with no caption

But... what if we want the reference type to be different from the actual object type? We’ll change the Person class to make it abstract, and make a concrete subclass Employee. Imagine we want the reference type to be Person, and the new object type to be Employee.

image with no caption
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset