This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes page 416 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "page 416" Watch "page 416" New topic
Author

page 416

Nikhil Jain
Ranch Hand

Joined: May 15, 2005
Posts: 385
<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


SCJP 1.4, SCWCD 1.4, SCBCD 1.5
Amit Tayal
Ranch Hand

Joined: Apr 25, 2006
Posts: 51
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
 
 
subject: page 416
 
Similar Threads
bean-related standard actions exercise
jsp:useBean standard action doubt
Is this an error in HFSJ ??
Bean related exercise question
Polymorphism of the jsp:useBean