Place the code snippets in the proper order to construct the JSP code to import static content into a JSP page at translation-time.
Select and Place:
Select and Place:
You have created a JSP that includes instance variables and a great deal of scriptlet code. Unfortunately, after extensive load testing, you have discovered several race conditions in your JSP scriptlet code. To fix these problems would require significant recoding, but you are already behind schedule. Which JSP code snippet can you use to resolve these concurrency problems?
A. <%@ page isThreadSafe='false' %>
B. <%@ implements SingleThreadModel %>
C. <%! implements SingleThreadModel %>
D. <%@ page useSingleThreadModel='true' %>
E. <%@ page implements='SingleThreadModel' %>
Which three are valid URL mappings to a servlet in a web deployment descriptor? (Choose three.)
A. */*
B. *.do
C. MyServlet
D. /MyServlet
E. /MyServlet/*
F. MyServlet/*.jsp
The Squeaky Bean company has decided to port their web application to a new J2EE 1.4 container. While reviewing the application, a developer realizes that in multiple places within the current application, nearly duplicate code exists that finds enterprise beans. Which pattern should be used to eliminate this duplicate code?
A. Transfer Object
B. Front Controller
C. Service Locator
D. Intercepting Filter
E. Business Delegate
F. Model-View-Controller
You need to create a JavaBean object that is used only within the current JSP page. It must NOT be accessible to any other page including those that this page might import. Which JSP standard action can accomplish this goal?
A.
B.
C.
D.
E.
F.
Given:
11.
public class MyServlet extends HttpServlet {
12.
public void service(HttpServletRequest request,
13.
HttpServletResponse response)
14.
throws ServletException, IOException {
15.
// insert code here
16.
}
17.
}
and this element in the web application's deployment descriptor:
Which, inserted at line 15, causes the container to redirect control to the error.html resource?
A. response.setError(302);
B. response.sendError(302);
C. response.setStatus(302);
D. response.sendRedirect(302);
E. response.sendErrorRedirect(302);
Your web application requires the ability to load and remove web files dynamically to the web container's file system. Which two HTTP methods are used to perform these actions? (Choose two.)
A. PUT
B. POST
C. SEND
D. DELETE
E. REMOVE
F. DESTROY
A custom tag is defined to take three attributes. Which two correctly invoke the tag within a JSP page? (Choose two.)
A.
B.
C.
D.
E.
F.
G.
For which three events can web application event listeners be registered? (Choose three.)
A. when a session is created
B. after a servlet is destroyed
C. when a session has timed out
D. when a cookie has been created
E. when a servlet has forwarded a request
F. when a session attribute value is changed
You want to create a valid directory structure for your Java EE web application, and you want to put your web application into a WAR file called MyApp.war. Which two are true about the WAR file? (Choose two.)
A. At deploy time, Java EE containers add a directory called META-INF directly into the MyApp directory.
B. At deploy time, Java EE containers add a file called MANIFEST.MF directly into the MyApp directory.
C. It can instruct your Java EE container to verify, at deploy time, whether you have properly configured your application's classes.
D. At deploy time, Java EE containers add a directory call META-WAR directly into the MyApp directory.
As a convenience feature, your web pages include an Ajax request every five minutes to a special servlet that monitors the age of the user's session. The client-side JavaScript that handles the Ajax callback displays a message on the screen as the session ages. The Ajax call does NOT pass any cookies, but it passes the session ID in a request parameter called sessionID. In addition, assume that your webapp keeps a hashmap of session objects by the ID. Here is a partial implementation of this servlet:
10.
public class SessionAgeServlet extends HttpServlet {
11.
public void service(HttpServletRequest request, HttpServletResponse) throws IOException {
12.
String sessionID = request.getParameter("sessionID");
13.
HttpSession session = getSession(sessionID);
14.
long age = // your code here
15.
response.getWriter().print(age);
16.
}
... // more code here
47. }
Which code snippet on line 14, will determine the age of the session?
A. session.getMaxInactiveInterval();
B. session.getLastAccessed().getTime() - session.getCreationTime().getTime();
C. session.getLastAccessedTime().getTime() - session.getCreationTime().getTime();
D. session.getLastAccessed() - session.getCreationTime();
E. session.getMaxInactiveInterval() - session.getCreationTime();
F. session.getLastAccessedTime() - session.getCreationTime();
Click the Exhibit button.
A servlet sets a session-scoped attribute product with an instance of com.example.Product and forwards to a JSP.
Which two output the name of the product in the response? (Choose two.)
A. ${product.name}
B.
C.
D.
E.
You are creating a content management system (CMS) with a web application front-end. The JSP that displays a given document in the CMS has the following general structure:
1.
<%-- tag declaration --%>
2.
11.
99.
The citation tag must store information in the document tag for the document tag to generate a reference section at the end of the generated web page.
The document tag handler follows the Classic tag model and the citation tag handler follows the Simple tag model. Furthermore, the citation tag could also be embedded in other custom tags that could have either the Classic or Simple tag handler model.
Which tag handler method allows the citation tag to access the document tag?
A. public void doTag() {JspTag docTag = findAncestorWithClass(this, DocumentTag.class); ((DocumentTag)docTag).addCitation(this.docID);}
B. public void doStartTag() {JspTag docTag = findAncestorWithClass(this, DocumentTag.class); ((DocumentTag)docTag).addCitation(this.docID);}
C. public void doTag() {Tag docTag = findAncestor(this, DocumentTag.class); ((DocumentTag) docTag).addCitation(this.docID);}
D. public void doStartTag() {Tag docTag = findAncestor(this, DocumentTag.class); ((DocumentTag) docTag).addCitation(this.docID);}
Which two statements are true about the security-related tags in a valid Java EE deployment descriptor? (Choose two.)
A. Every
B. A
C. A given
D. A given
E. It is possible to construct a valid
The JSP developer wants a comment to be visible in the final output to the browser. Which comment style needs to be used in a JSP page?
A.
B. <% // this is a comment %>
C. <%-- this is a comment --%>
D. <% /** this is a comment **/ %>