Java EE 7 Application Developer — Question 63
Which two statements are true about the relationship between JavaServer Pages (JSP) and servlets? (Choose two.)
Answer options
- A. A JSP page must extend the HTTPServlet class to behave like a servlet.
- B. A JSP page has access to the same information, objects, and a context as a servlet.
- C. A JSP page is interpreted by JSPServlet.
- D. A JSP page must be written as either an XML file or a JSP file before it is turned into a servlet.
Correct answer: A, D
Explanation
Option A is correct because JSP pages are compiled into servlets that extend the HTTPServlet class. Option D is also correct as JSP pages are ultimately translated into servlet code, which requires them to conform to specific formats. Options B and C are incorrect; while a JSP page has access to servlet context, it does not necessarily extend the same class, and JSP pages are compiled by the server, not directly interpreted by JSPServlet.