Consider the following
java code:
Just to share this knowledge .....
Detailed Explanation
Concept: Whenever you see class and type attribute both in the use bean tag, visualize the tag like this:
typevalue obj = (typevalue) new classValue;
And see, if it is valid at compiletime and runtime.
Here, applying the same logic we get:
MusicCD obj = (MusicCD) new Book();
It is clear that you cannot cast a Book object to MusicCD object because MusicCD does not extend from Book. So this is a compile time error.
so relation is required between class amd type attribute before the use of <useBean> tag in
JSP.