多項(xiàng)選擇題

You are creating a new JSP page and you need to execute some code that acts when the page is firstexecuted, but only once.
Which three are possible mechanisms for performing this initialization code?()

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.


您可能感興趣的試卷

你可能感興趣的試題

2.單項(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"); %>

3.單項(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>

4.單項(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++; %>

5.單項(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>

最新試題

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

題型:?jiǎn)柎痤}

A web application allows the HTML title banner to be set using a servlet context initialization parametercalled titleStr.Which two properly set the title in this scenario?()

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

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

題型:?jiǎn)柎痤}

You need to create a JSP that generates some JavaScript code to populate an array of strings used on the client-side.Which JSP code snippet will create this array?()

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

You are building your own layout mechanism by including dynamic content for the page’s header and footersections. The footer is always static, but the header generates the <title> tag that requires the page name tobe specified dynamically when the header is imported.Which JSP code snippet performs the import of theheader content?() 

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

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)選擇題

Given a web application in which the request parameter productID contains a product identifier.Which twoEL expressions evaluate the value of the productID?()

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

A web browser need NOT always perform a complete request for a particular page that it suspects mightNOT have changed. The HTTP specification provides a mechanism for the browser to retrieve only a partialresponse from the web server; this response includes information, such as the Last-Modified date but NOTthe body of the page.Which HTTP method will the browser use to retrieve such a partial response?()

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

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

題型:?jiǎn)柎痤}

All of your JSPs need to have a link that permits users to email the web master. This web application islicensed to many small businesses, each of which have a different email address for the web master. Youhave decided to use a context parameter that you specify in the deployment descriptor, like this:42.<context-param>43.<param-name>webmasterEmail</param-name>44.<param-value>master@example.com</param-value>45.</context-param>Which JSP code snippet creates this email link?()

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