多选题 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?()
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.
单选题 A web application uses the HttpSession mechanism to determine if a user is "logged in." When a usersupplies a valid user name and password, an HttpSession is created for that user. The user has access tothe application for only 15 minutes after logging in. The code must determine how long the user has beenlogged in, and if this time is greater than 15 minutes, must destroy the HttpSession. Which method in HttpSession is used to accomplish this?()
Getcreationtime
Invalidateafter
Getlastaccessedtime
Getmaxinactiveinterval
单选题 Which statement is true about web container session management?()
Access to session-scoped attributes is guaranteed to be thread-safe by the web container.
To activate URL rewriting, the developer must use the HttpServletResponse.setURLRewriting method.
If the web application uses HTTPS, then the web container may use the data on the HTTPS request stream to identify the client.
The JSESSIONID cookie is stored permanently on the client so that a user may return to the web application and the web container will rejoin that session.
单选题 A developer is designing a web application which extensively uses EJBs and JMS. The developer finds thatthere is a lot of duplicated code to build the JNDI contexts to access the beans and queues. Further,because of the complexity, there are numerous errors in the code. Which J2EE design pattern provides asolution for this problem?()
Command
Transfer Object
Service Locator
Session Facade
Business Delegate
单选题 Given an HttpSession session,a ServletRequest request,and a ServletContext context,which retrieves aURL to /WEB-INF/myconfig.xml within a web application?()
session.getResource(/WEB-INF/myconfig.xml)
request.getResource(/WEB-INF/myconfig.xml)
context.getResource(/WEB-INF/myconfig.xml)
getClass().getResource(/WEB-INF/myconfig.xml)
多选题 Click the Exhibit button. The Appliance class is a Singleton that loads a set of properties into a Map from an external data source.Assume: An instance of the Appliance class exists in the application-scoped attribute, appl The appliance object includes the name property that maps to the value Cobia The request- scoped attribute, prop,has the valuename. Which two EL code snippets will display the string Cobia?()
${appl.properties.name}
${appl.properties.prop}
${appl.properties[prop]}
${appl.properties[name]}
${appl.getProperties().get(prop)}
${appl.getProperties().get(’name’)}
多选题 Which two classes or interfaces provide a getSession method?()
javax.servlet.http.HttpServletRequest
javax.servlet.http.HttpSessionContext
javax.servlet.http.HttpServletResponse
javax.servlet.http.HttpSessionBindingEvent
javax.servlet.http.HttpSessionAttributeEvent
多选题 Given: 3.class MyServlet extends HttpServlet { 4.public void doPut(HttpServletRequest req, HttpServletResponse resp) throws ServletException,IOException { 5.// servlet code here ... 26.} 27.} If the DD contains a single security constraint associated with MyServlet and its only tagsand tags are:GETPUT Admin Which four requests would be allowed by the container?()
A user whose role is Admin can perform a PUT.
A user whose role is Admin can perform a GET.
A user whose role is Admin can perform a POST.
A user whose role is Member can perform a PUT.
A user whose role is Member can perform a POST.
A user whose role is Member can perform a GET.
多选题 Which two actions protect a resource file from direct HTTP access within a web application?()
Placing it in the /secure directory
Placing it in the /WEB-INF directory
Placing it in the /META-INF/secure directory
Creating a element within the deployment descriptor