Suppose there is a bean class Person and Employee extends person.
So when we want to create the Person bean in our jsp, then we need to make the reference variable type person and an object an instance of class Employee. It can be done by adding type attribute(to specify the super class).
<jsp:usebean id=”person” type=foo.Person class=”foo.Employee” scope=”page”>
How the servlet is generated here,
foo.person=null;
……….
If(person==null){
Person=new foo.Employee();
……..
But in previous case(only person bean no super class) the generated servlet is like
If(person==null){
Person=new foo.person();
}
Here the type attribute can be class type, abstract type, or interface type.
No comments:
Post a Comment