• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Doubt in jsp mock exam Chp 7

 
vikey Sharma
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi this is regarding one question in mock exam of Ch.7 (Head First JSP & Servlet).Question 11. Page 332
----------------------------------------------------------
Given:

Which statements are true ?
And one of the correct answer is F:
F)All four lines in this example would be valid in jsp page.
-----------------------------------------------------------

I feel this option is not correct but in answers they give as correct option.

Now as per my understanding unless you use it this way its not going to work.To make this answer correct code should be this way



Even its not going to compile as "user.isvalid()" will give compilation error.

Note that i have added here <jsp:userBean>.

Dont you think with the given code in book (F) will be wrong answer ?
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<%if (user.isValid()){%> You are Valid <% }%>

That's right. If user is not defined anywhere, it will not compile. It should be written "Assuming that user is a valid variable". And we need to see the content of the user class as well.
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic