|
SCWCD : JSP page life cycle Mock Exam Practice Questions
Questions no -1
After translation of a JSP source page into its implementation class, The jsp implementation class is ________ ?
options
A)final
B)static
C)abstract
D)private
Correct answer is : A
Explanations : After translation JSP page looks like :
public final class test_jsp extends org.apache.jasper.runtime.HttpJspBase
implements org.apache.jasper.runtime.JspSourceDependent {
...
}
Questions no -2
What is the output of the below test.jsp ?
//test.jsp
<%!
public void _jspService(HttpServletRequest request, HttpServletResponse response)
throws java.io.IOException, ServletException {
out.println("Hello");
}
%>
options
A)Hello
B)Compile Error - _jspService(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse) is already defined in org.apache.jsp.test_jsp
C)Runtime exception
D)None of the above
Correct answer is : D
Explanations : After translation JSP page _jspService automatically created by JSP compiler. In the JSP page if you define method name _jspService(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse) then compiler will complain _jspService(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse) is already defined in org.apache.jsp.test_jsp.
| |