Win a copy of The Business Blockchain this week in the Cloud forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HFSJ final mock exam question 63

 
Radmika Arunachalam
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
In HFSJ final mock exam Q63


given answer is D, but my answer is E because of 2 facts
1. question clearly says it is complete JSP
2. there is no useBean for "x" used in jsp:setProperty

Please let me know your thoughts?

Thanks & Regards,
Radmika
SCJP, SCBCD
 
J Johny Rufus
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Radmika,

Line 4 need not throw an error under one condition .
If the custom tags used in lines 2 or 3 had introduced a scripting variable by the name "x" , then line 4 will work fine.
Custom Tags can introduce scripting variables using the <tei-class> and the variableInfo entry .

As per the spec

"The value of the name attribute in jsp:setProperty and jsp:getProperty will refer to an object that is obtained from the pageContext object through its findAttribute method.

The object named by the name must have been "introduced" to the JSP processor using either the jsp:useBean action or a custom action with an associated VariableInfo entry for this name "

You can refer how to do this using the following links
http://www.nakov.com/inetjava/lectures/part-3-webapps/InetJava-3.9-JSP-Tag-Libraries-Tutorial.html
or
http://e-docs.bea.com/wls/docs90/taglib/handler.html

Hope this helps,

All the best for your exam

Thanks and Regards,
Rufus
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic