Page: 5
UNIT-6: The JavaServer Pages (JSP) Technology Model
Q12. Every page of your web site must include a common set of navigation menus at the top of the page. This menu is static HTML and changes frequently, so you have decided to use JSP's static import mechanism. Which JSP code snippet accomplishes this goal? A. <%@ import file='/common/menu.html' %> B. <%@ page import='/common/menu.html' %> C. <%@ import page='/common/menu.html' %> D. <%@ include file='/common/menu.html' %> E. <%@ page include='/common/menu.html' %> F. <%@ include page='/common/menu.html' %> Answer: D Q13. For manageability purposes, you have been told to add a "count" instance variable to a critical JSP Document so that a JMX MBean can track how frequent this JSP is being invoked. Which JSP code snippet must you use to declare this instance variable in the JSP Document?
A. <jsp:declaration> int count = 0; <jsp:declaration> B. <%! int count = 0; %> C. <jsp:declaration.instance> int count = 0; <jsp:declaration.instance> D. <jsp:scriptlet.declaration> int count = 0; <jsp:scriptlet.declaration> Answer: A Q14. You are creating a new JSP page and you need to execute some code that acts when the page is first executed, but only once. Which three are possible mechanisms for performing this initialization code? (Choose three.) A. In the init method. B. In the jspInit method. C. In the constructor of the JSP's Java code. D. In a JSP declaration, which includes an initializer block. E. In a JSP declaration, which includes a static initializer block. Answer: B, D, E
Page: 5
1
2
3
4
5
6
7
8
9
10
|