Hello Everyone,
I just started doing the mock exams and i am having difficulty in understanding the answer given for the following question from "Eduardo Cobian's" mock exam.
Given the following
jsp line select the correct statements:
<% public void jspInit() { ...java code...} %>
1) It is a valid line that can be used to initialize the
servlet that implements the jsp file.
2) It won't compile as no identifer can start with jsp not _jsp.
3) It will serve as the servlet initialization if the function's name is _jspInit.
4) There is no way to initialize a jsp's implementation class servlet.
According to the solution given, it says option 1 is correct. But i thought that jspInit method should always be placed under a declaration.
<% public void jspInit() { ...java code...} %>
As this becomes a scriplet, i thought this would be included under the service method when a servlet is generated and hence will result in an error. so according to me none of the answers are correct.
Please correct me if i am wrong.