DOUBT ON BEAN RELATED STANDARD ACTION EXERCISE(page 416 0f HFSJ)
Given:
<
jsp:useBean id="person" type="foo.employee">
<jsp:setProperty name="person" property="name" value="Fred" ?>
</jsp:useBean>
Name is:<jsp:getProperty name="person" property="name" ?>
..............................................................................
[Here class Employee extends an abstract class Person]
and the related
servlets are:
(1) foo.Person p=new foo.Employee();
p.setName("Evan");
request.setAttribute("person",p);
second servlet
(2) foo.Employee p=foo.Employee();
p.setName("Evan");
request.setAttribute("person",p);
The answers given are:
(1) fails at request time. the person attribute is stored at request scope.
(2)
and the second one works fine and prints out "evan".
But i find them contradictory answers. Since, both attributes are request scope. Both should fail.