reset password
Author Message
cysun
Posts: 2935
Posted 14:51 Feb 14, 2012 |

As we discussed in class, the main issue here is whether a "setter" that returns a value (instead of void) is still considered a setter. In particular, is the following method in Map.Entry<K,V> a setter:

V setValue( V value )

It turns out that the answer is NO.

According to JavaBeans Specification (Section 7.1 and 8.3), a setter should not have a return values. You may verify this by changing some setters in our code examples - for example, change a setter in BGBean.java so it returns a value, and you'll notice that <jsp:setProperty> can no longer set that property because the "setter" is not a setter anymore.

So for Q1 and Q2 in Lab 1, the correct answers are 2 and 2. If you lost some point(s) there, please contact me or Sherry and we'll correct it.