Forums Register Login

HFSJ final mock exam question 63

+Pie Number of slices to send: Send
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
+Pie Number of slices to send: Send
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
When people don’t understand what you are doing they call you crazy. But this tiny ad just doesn't care:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 668 times.
Similar Threads
Confused about HFSJ Final Mock Exam Question 63
HFSJ 1 Edition mock doubt
Q 63 from SCWCD mock exam
JSP question shared
HFSJ Mock Exam doubt
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 03:39:03.