• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

HFSJ final mock exam question 63

 
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
reply
    Bookmark Topic Watch Topic
  • New Topic