I have the following doubts about the HFSJ final mock exam:
Question 12: In this question, the tld specifies body-content as empty, but the tag handler class extends TagSupport, and in its doStartTag, it returns SKIP_BODY or EVAL_BODY_INCLUDE based on an if condition. My doubt is that even if it compiles fine, shouldn't it throw translation error, as we cannot return EVAL_BODY_INCLUDE if the body-content is defined as empty?
Question 22: This question asks which JSP code would you use to include static content in a JSP; this marks jsp:include standard action as a correct answer, but gives RequestDispatcher.include() as wrong answer. My doubt is that if jsp:include is correct, why is RequestDispatcher.include() wrong?
Question 40: This question says that the following statement is true: "The web container calls the servlet's destroy() method when the servlet is destroyed or unloaded." My doubt is that destroy() method is called BEFORE the servlet is destroyed, not when (just after)
Question 63: In this question, it says that line 4 (jsp:setProperty) will not generate an error... but my doubt is that before jsp:setProperty, we are not having any jsp:useBean declaration... so shouldn't it generate an error???
Question 12 It should give runtime error when you try running the jsp page but oh they have not even mentioned that as an option.
Question 22 : It is weird since RequestDispatcher option also seems to be true but what i can make out max from it is it should be inside the scriptlet to make it a valid option (i know this seems stupid but thats the max i can think on it)
Question 40 : destroy() method is called just before the servlet is destroyed .your are right on it i guess.
Question 63 : you are again right on it ...i tried it it gave error.
Hope i cleared things up. Regards Rishi Chopra
Life is Beautiful Learn to See it.........
Joined: Dec 20, 2006
Thanks a lot Rishi (I was too lazy to type the questions )
But I agree with you on the RequestDispatcher question (no. 22), because that code is servlet, not JSP (it is not inside a scriptlet)
But the rest of the questions (or rather, the answers given) are still confusing for me...
Just encountered number 63, got me a bit angry.
Relief that I was right in my understanding that first a bean has to be instantiated before any value can be set.
(or setProperty in the body of useBean...)