class abstract Person {
String getName()
void setName(String)
}
class Employee extends Person {
int getEmpId()
void setEmpId(int)
}
servlet code:
Person p =new Employee();
p.setName("Evan");
request.setAttribute("person",p);
jsp:
<jsp:UseBean id="person" type="Employee" scope="request" >
<jsp:setProperty name="person" property="name" value="fred" />
</jsp:useBean>
Name is:<jsp:getProperty name="person" property="name" />
In Head first its given that the above code fails at request time .The person attribute is stored at request scope ,so the <jsp:useBean> tag wont work since it specifies only a type.The container knows that if you have only a type specified,there must be an existing attribute of that name and scope.
Iam not clear with the answer .acn nyone clear my doubt?
Can