posted 17 years ago
Yes,
<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"/>
What happens if the servlet code looks like:
foo.Person p = new foo.Employee();
p.setName("Evan");
request.setAttribute("person", p);
The above one fails at request time, but whereas
foo.Employee p = new foo.Employee();
p.setName("Evan");
request.setAttribute("person", p);
This works fine and prints Evan! How? We are only specifying the type? aren't we??
Also, if I comment out all the p.setName("Evan") in all the 2 cases above, then the o/p will be Fred right??
SCJP 1.4, SCWCD 1.4 - Hints for you, Certified Scrum Master
Did a rm -R / to find out that I lost my entire Linux installation!