單項(xiàng)選擇題

In a JSP-centric web application, you need to create a catalog browsing JSP page. The catalog is stored asa List object in the catalog attribute of the webapp’s ServletContext object. 
Which scriptlet code snippetgives you access to the catalog object?()

A.<% List catalog = config.getAttribute("catalog"); %>
B.<% List catalog = context.getAttribute("catalog"); %>
C.<% List catalog = application.getAttribute("catalog"); %>
D.<% List catalog = servletContext.getAttribute("catalog"); %>


您可能感興趣的試卷

你可能感興趣的試題

1.單項(xiàng)選擇題

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 snippetmust 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>

2.單項(xiàng)選擇題

For debugging purposes, you need to record how many times a given JSP is invoked before the user’ssession has been created. The JSP’s destroy method stores this information to a database.
Which JSPcode snippet keeps track of this count for the lifetime of the JSP page?()

A.<%! int count = 0; %><% if ( request.getSession(false) == null ) count++; %>
B.<%@ int count = 0; %>. <% if ( request.getSession(false) == null ) count++; %>
C.<% int count = 0;. if ( request.getSession(false) == null ) count++; %>
D.<%@ int count = 0;. if ( request.getSession(false) == null ) count++; %>
E.<%! int count = 0;. if ( request.getSession(false) == null ) count++; %>

3.單項(xiàng)選擇題

You are building JSP pages that have a set of menus that are visible based on a user’s security role. Thesemenus are hand-crafted by your web design team; for example, the SalesManager role has a menu in thefile /WEB-INF/html/sales-mgr-menu.html.
Which JSP code snippet should be used to make this menuvisible to the user?()

A.<% if ( request.isUserInRole("SalesManager") ) { %> <%@ include file=’/WEB-INF/html/sales-mgr-menu.html’ %> <% } %>
B.<jsp:if test=’request.isUserInRole("SalesManager")’> <%@ include file=’/WEB-INF/html/sales-mgr-menu.html’ %> </jsp:if>
C.<% if ( request.isUserInRole("SalesManager") ) { %> . <jsp:include file=’/WEB-INF/html/sales-mgr-menu.html’ /> . <% } %>
D.<jsp:if test=’request.isUserInRole("SalesManager")’> <jsp:include file=’/WEB-INF/html/sales-mgr-menu.html’ /> </jsp:if>

4.多項(xiàng)選擇題Which two are true regarding a web application class loader?()

A.A web application may override the web container’s implementation classes.
B.A web application running in a J2EE product may override classes in the javax.* namespace.
C.A web application class loader may NOT override any classes in the java.* and javax.* namespaces.
D.Resources in the WAR class directory or in any of the JAR files within the library directory may be accessed using the J2SE semantics of getResource.

5.多項(xiàng)選擇題Which three are described in the standard web application deployment descriptor?()

A.session configuration
B.MIME type mappings
C.context root for the application
D.servlet instance pool configuration
E.web container default port bindings
F.Servlet Context initialization parameters

最新試題

Click the ’Select and Place’ button.Place the events in the order they occur.

題型:?jiǎn)柎痤}

Click the ’Select and Place’ button.Place the events in the order they occur.

題型:?jiǎn)柎痤}

Click the Exhibit button.The attribute "name" has a value of "Foo,"What is the result if this tag handler’s tag is invoked?()

題型:?jiǎn)雾?xiàng)選擇題

Which two are valid and equivalent?()

題型:多項(xiàng)選擇題

You are building a web application with a scheduling component. On the JSP, you need to show the currentdate, the date of the previous week, and the date of the next week. To help you present this information,you have created the following EL functions in the ’d’ namespace: name: curDate; signature: java.util.DatecurrentDate() name: addWeek; signature: java.util.Date addWeek(java.util.Date, int) name: dateString;signature:java.util.String getDateString(java.util.Date)Which EL code snippet will generate the string for the previousweek?

題型:?jiǎn)雾?xiàng)選擇題

Which three are true about servlet filters?()

題型:多項(xiàng)選擇題

Given a Filter class definition with this method:21.public void doFilter(ServletRequest request,22.ServletResponse response,23.FilterChain chain)24.throws ServletException, IOException {25.// insert code here26.}Which should you insert at line 25 to properly invoke the next filter in the chain, or the target servlet if thereare no more filters?()

題型:?jiǎn)雾?xiàng)選擇題

Click the ’Select and Place’ button.Place the events in the order they occur.

題型:?jiǎn)柎痤}

Your company has a corporate policy that prohibits storing a customer’s credit card number in anycorporate database. However, users have complained that they do NOT want to re- enter their credit cardnumber for each transaction. Your management has decided to use client-side cookies to record the user’scredit card number for 120 days. Furthermore, they also want to protect this information during transit fromthe web browser to the web container; so the cookie must only be transmitted over HTTPS.Which codesnippet creates the "creditCard" cookie and adds it to the out going response to be stored on the user’s webbrowser?()

題型:?jiǎn)雾?xiàng)選擇題

Click the ’Select and Place’ button.Place the events in the order they occur.

題型:?jiǎn)柎痤}