• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Error in the final mock exam Qn 63?

 
warren li
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Qn63 of the final mock exam in the HFSJ book is given the correct answer D.
but line 4 should also generate an error. The bean name "x" is never defined in the jsp.

According to jsp spec:

JSP.5.2 <jsp:setProperty>
The jsp:setProperty action sets the values of properties in a bean. The name
attribute that denotes the bean must be defined before this action appears.

Anyone?
 
warren li
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
anyone bothered to look at this mock question again?
 
Ali Gohar
Ranch Hand
Posts: 572
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is Q63? Post it
 
warren li
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is the question:
-----------------------------------------

Assume this is a complete JSP, which lines will definitely generate errors?

 
Ali Gohar
Ranch Hand
Posts: 572
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
According to me, line 5 should definitely generate an error.

but line 4 should also generate an error. The bean name "x" is never defined in the jsp.


Yes, line 4 can also generate error if bean name "x" is not in scope.

But if you look at the question, the stress is on definately

It is quite possible that some servlet set the bean name "x" in scope, so in that case line 4 will not generate any error.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic