This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of The Little Book of Impediments (e-book only) and have Tom Perry on-line!
See this thread for details.
Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HF Servlets & JSP: Chapt 8 Mock Exam Q2

 
Chengwei Lee
Ranch Hand
Posts: 884
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Was doing the mock exam for chapter 8 on scriptless JSP & I thought all 4 options provided were incorrect.

Option C was suppose to be the right answer.



Correct me if I'm wrong, I thought it was wrong to have 2 pair of single quotes. The answer should rather be:



Was it a typo? Or its ok to have 2 pairs of single quotes?
 
Mishra Anshu
Ranch Hand
Posts: 224
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes,
Two pairs of either single or (even) double, quotes will make it to understand something else.
Whenever a matching quote will come that will be tried to be evaluated.
It looks like to be a typo.
 
Bryan Basham
author
Ranch Hand
Posts: 199
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
While this looks like a typo, this code is actually fine.

The JSP translator performs several passes on the JSP file and it handles EL code separate from template code. Therefore, all of these variations are valid and are equivalent:





Ultimately, what the parser does is it looks for ${ <expr> } and parses the <expr> EL expression separately from the template text <a href='mailto:EL-expr'>email me</a>.

Does that help?

-Bryan
 
Mishra Anshu
Ranch Hand
Posts: 224
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks.
 
Chengwei Lee
Ranch Hand
Posts: 884
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It sure did helped a lot! Thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic