• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

page 416

 
Nikhil Jain
Ranch Hand
Posts: 389
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<jsp:useBean id="person" type="foo.Employee">
<jsp:setProperty name="person" property="name" value="fred" />
</jsp:useBean>

What happens if the servlet code looks like;
foo.Person p = new foo.Employee();
p.setName("Evan");
request.setAttribute("person", p);

This is the question on page 416 of HFS

My questio is, that in usebean we mention type to be "foo.Employee"
but in servlet we have type foo.Person... is this not an error..

please reply
 
Amit Tayal
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Shashank
Even though the reference type is Person in servlet but the object is of type of Employee.
So, you can mention reference type as Employee in usebean.

Amit
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic