• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

EL Question

 
deepa raj
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator



container will check an find the account attribute and it will try to call
getPersonalChecking method.

am i right??
 
Amruth Puppala
Ranch Hand
Posts: 295
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Container will find wether this account is Attrbute or bean or map otherwise throws Exception. then try to call getPersonalChecking method
 
deepa raj
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if so what is the answer for this question from HFSJ Mock exam 2


 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
getter methods for booleans are not getXXX but isXXX.
 
Sandeep Bhandari
Ranch Hand
Posts: 201
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
my take is option C.

what's the official answer?
 
deepa raj
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Answers are A,B,C
 
Amandeep Singh
Ranch Hand
Posts: 850
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A. <c:if test='${account.personalChecking}'>Checkingthat fits your lifestyle.</c:if>B. <c:if test='${account["personalChecking"]}'>Checkingthat fits your lifestyle.</c:if>C. <c:if test="${account[�personalChecking']}">Checkingthat fits your lifestyle.</c:if>D. <c:if test='${account.isPersonalChecking}'>Checkingthat fits your lifestyle.</c:if>



Here we can't use the D option because in EL you can never invoke a method(isPersonalChecking) on the object(account).

In EL you can always access the property of a object.

As this method name is following the name convention... isXXX

So here PersonalChecking turns out to be a property.

So in the first three options, its trying to access the bean or object(account) property(PersonalChecking).

Makes Sense?

Cheers...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic