GeeCON Prague 2014*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes HFSJ Chapter 7 Page 341 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "HFSJ Chapter 7 Page 341" Watch "HFSJ Chapter 7 Page 341" New topic
Author

HFSJ Chapter 7 Page 341

Suhas Wadadekar
Ranch Hand

Joined: May 16, 2006
Posts: 95
The explanation to Question 15 says,

"Options A and D are invalid because only Java statements may be included within <% .... %> tags"

Option D <% import java.util.Date; %> looks pretty much correct Java syntax to me. I must agree I was confused by this answer choice and even confused by the answer/explanation.

Thanks,
Suhas
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9303
    
  17

Everything between the <% and %> goes inside the service method of the converted servlet of the JSP. So if you write <% import java.util.Date; %>, it will look like


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
Suhas Wadadekar
Ranch Hand

Joined: May 16, 2006
Posts: 95
Makes sense Ankit. Thanks for pointing that out. I was definitely not paying attention to what I was reading.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: HFSJ Chapter 7 Page 341