This is one of the questions in HFSj (pg492)
A JavaBean
Person has a property called
address.The value of this is property is another Java Bean
Address with the following string properties :
street1,
street2,
city,
stateCode and
zipeCode.
A Controller servlet creates a session-scoped attribute called
customer that is an instance of the
Person bean.
Which Jsp Code structures will set the
city property of the
customer attribute to the
city request parameter?
A. ${sessionScope.customer.address.city = param.city}
B. <c:set target="${sessionScope.customer.address)" property="city" value="${param.city"} />
C. <c:set scope=session var="${customer.address}" property="city" value="${param.city"} />
D.<c:set target="${sessionScope.customer.address}" property="city"> ${param.city"} </c:set>
Ans. B,D
I am getting confused with the terms
Property and
Attribute of JavaBean.
I did figure out the right answer (only one) by the method of elimination rather then understanding
So a Java Bean
Person has a property
address would mean it has a getAddress() and setAddress() methods.
The value of this property Java Bean
Address with the string properties..........................
I am losing it from here .. Can some one explain this programatically and how we arrived the answer?
Thanks!