<%! int count = 0; %><% if ( request.getSession(false) == null ) count++; %>
<%@ int count = 0; %>. <% if ( request.getSession(false) == null ) count++; %>
<% int count = 0;. if ( request.getSession(false) == null ) count++; %>
<%@ int count = 0;. if ( request.getSession(false) == null ) count++; %>
<%! int count = 0;. if ( request.getSession(false) == null ) count++; %>
第1题:
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?()
第2题:
You need to create a servlet filter that stores all request headers to a database for all requests to the webapplication’s home page "/index.jsp". Which HttpServletRequest method allows you to retrieve all of therequest headers?()
第3题:
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
第4题:
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?()
第5题:
You are building a Front Controller using a JSP page and you need to determine if the user’s session hasNOT been created yet and perform some special processing for this case. Which scriptlet code snippet willperform this test?()
第6题:
String[] getHeaderNames()
String[] getRequestHeaders()
java.util.Iterator getHeaderNames()
java.util.Iterator getRequestHeaders()
java.util.Enumeration getHeaderNames()
第7题:
Error
Exception
Throwable
Request error
Request exception
第8题:
In the init method.
In the jspInit method.
In the constructor of the JSP’s Java code.
In a JSP declaration, which includes an initializer block.
In a JSP declaration, which includes a static initializer block.
第9题:
<% if ( request.isUserInRole(SalesManager) ) { %> <%@ include file=’/WEB-INF/html/sales-mgr-menu.html’ %> <% } %>
<jsp:if test=’request.isUserInRole(SalesManager)’> <%@ include file=’/WEB-INF/html/sales-mgr-menu.html’ %> </jsp:if>
<% if ( request.isUserInRole(SalesManager) ) { %> . <jsp:include file=’/WEB-INF/html/sales-mgr-menu.html’ /> . <% } %>
<jsp:if test=’request.isUserInRole(SalesManager)’> <jsp:include file=’/WEB-INF/html/sales-mgr-menu.html’ /> </jsp:if>
第10题:
<% if ( request.getSession(false) == null ) {// special processing} %>
<% if ( request.getHttpSession(false) == null ) {// special processing} %>
<% if ( requestObject.getSession(false) == null ) { // special processing} %>
<% if ( requestObject.getHttpSession(false) == null ) { // special processing} %>
第11题:
<jsp:declaration>int count = 0;<jsp:declaration>
<%! int count = 0; %>
<jsp:declaration.instance>int count = 0;. <jsp:declaration.instance>
<jsp:scriptlet.declaration>int count = 0;. <jsp:scriptlet.declaration>
第12题:
getCreationTime
invalidateAfter
getLastAccessedTime
getMaxInactiveInterval
第13题:
A web application uses the HttpSession mechanism to determine if a user is “logged in”. When a user supplies a valid user name and password, an HttpSession is created for that user. The user has access to the application for only 15 minutes after logging in. The code must determine how long the user has been logged in, and if this time is greater than 15 minutes, must destroy the HttpSession. Which method in HttpSession is used to accomplish this?()
第14题:
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?()
第15题:
Given this fragment from a Java EE deployment descriptor: 341.
第16题:
Your web application uses a simple architecture in which servlets handle requests and then forward to aJSP using a request dispatcher. You need to pass information calculated in the servlet to the JSP for view generation.This information must NOT be accessible to any other servlet,JSP or session in the webapp. Which two techniques can you use to accomplish this goal?()
第17题:
TestKing.com has a SQL Server 2005 computer. You have been assigned the task of retrieving information about a user who is currently logged in. You need to create a function that returns scalar information about the activity time for a particular user. What are two possible ways to achieve this goal?()
第18题:
Store the data in a public instance variable in the servlet.
Add an attribute to the request object before using the request dispatcher.
Add an attribute to the context object before using the request dispatcher.
This CANNOT be done as the tag handler has no means to extract this data.
第19题:
Never
Once
Twice
第20题:
a table name which has 100s of records
a table name which has 10s of records
a table name which has empty records
a table name which has 1000s of records
never use a table name
第21题:
Add attributes to the session object.
Add attributes on the request object.
Add parameters to the request object.
Use the pageContext object to add request attributes.
Add parameters to the JSP’s URL when generating the request dispatcher.
第22题:
The deployment descriptor is invalid.
The container invokes mainError.jsp.
The container invokes castError.jsp.
Neither mainError.jsp nor castError.jsp is invoked.
第23题:
<%! int count = 0; %><% if ( request.getSession(false) == null ) count++; %>
<%@ int count = 0; %>. <% if ( request.getSession(false) == null ) count++; %>
<% int count = 0;. if ( request.getSession(false) == null ) count++; %>
<%@ int count = 0;. if ( request.getSession(false) == null ) count++; %>
<%! int count = 0;. if ( request.getSession(false) == null ) count++; %>