You are writing a JSP that includes scriptlet code to declare a List variable and initializes that variable to anArrayList object.
Which two JSP code snippets can you use to import these list types?()
A.<%! import java.util.*; %>
B.<%! import java.util.List;import java.util.ArrayList; %>
C.<%@ page import=’java.util.List’import=’java.util.ArrayList’ %>
D.<%@ import types=’java.util.List’types=’java.util.ArrayList’ %>
E.<%@ page import=’java.util.List,java.util.ArrayList’ %>
F.<%@ import types=’java.util.List,java.util.ArrayList’ %>
您可能感興趣的試卷
你可能感興趣的試題
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.
Given the element from the web application deployment descriptor:
<jsp-property-group>
<url-pattern>/main/page1.jsp</url-pattern>
<scripting-invalid>true</scripting-invalid>
</jsp-property-group>
and given that /main/page1.jsp contains:
<% int i = 12; %>
<b><%= i %></b>
What is the result?()
A.<b></b>
B.<b>12</b>
C.The JSP fails to execute.
D.<% int i = 12 %><b><%= i %></b>
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"); %>
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>
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++; %>
最新試題
Click the ’Select and Place’ button.Place the events in the order they occur.
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?()
Which is a benefit of precompiling a JSP page?()
Click the ’Select and Place’ button.Place the events in the order they occur.
Click the ’Select and Place’ button.Place the events in the order they occur.
Click the ’Select and Place’ button.Place the events in the order they occur.
Click the 'Select and Place' button.Place the events in the order they occur.
Which ensures that a JSP response is of type "text/plain"?()
Click the ’Select and Place’ button.Place the events in the order they occur.
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?