<jsp:useBean id="person"
type="foo.Employee">
<jsp:setProperty name="person" property="name" value"Fred"/>
</jsp:useBean>
servlet code:
foo.Person =new foo.Employee();
p.setName("Evan");
request.setAttribute("person",p);
the answer given for this "Be the Container" is -it wont work because container looks for bean in page scope while actual bean exists in request scope.
Ok..now my doubt... lets make the scope as request instead of default page scope
<jsp:useBean id="person" type="foo.Employee" scope="request">
will this work??
i mean i'm not sure how container generates the code when only type is given..
foo.Employee person=null;
synchronized(request){
person=(???downcastedto???)pageContext.getAttribute("person",PageContext.REQUST_SCOPE)
....
}
person will be downcasted to foo.Employee or foo.Person??if it is foo.Person then u get an exception since u cant assign foo.Person object to foo.Employee reference..
i'm confused