Which method must be used to encode a URL passed as an argument to HttpServletResponse.sendRedirect when using URL rewriting for session tracking?()
A.ServletResponse.encodeURL B.HttpServletResponse.encodeURL C.ServletResponse.encodeRedirectURL D.HttpServletResponse.encodeRedirectURL
单项选择题Whichinterfacemustaclassimplementsothatinstancesoftheclassarenotifiedafteranyobjectisaddedtoasession?()
A.javax.servlet.http.HttpSessionListener B.javax.servlet.http.HttpSessionValueListener C.javax.servlet.http.HttpSessionBindingListener D.javax.servlet.http.HttpSessionAttributeListener
单项选择题In your web application,you need to execute a block of code whenever the session object is first created. Which design will accomplish this goal?()
A.Create an HttpSessionListener class and implement the sessionInitialized method with that block ofcode. B.Create an HttpSessionActivationListener class and implement the sessionCreated method with thatblock of code. C.Create a Filter class, call the getSession(false) method, and if the result was null, then execute that block of code. D.Create an HttpSessionListener class and implement the sessionCreated method with that block of code.
单项选择题Whatisthepurposeofsessionmanagement?()
A.To manage the user’s login and logout activities. B.To store information on the client-side between HTTP requests. C.To store information on the server-side between HTTP requests. D.To tell the web container to keep the HTTP connection alive so it can make subsequent requestswithout the delay of making the TCP connection.
多项选择题A web application contains a tag file called beta.tag in WEB-INF tags alpha. A JSP page called sort.jspexists in the web application and contains only this JSP code: 1.<%@ taglib prefix= x 2.tagdir= WEB-INF tags alpha %> 3.<x:beta > The sort.jsp page is requested. Which two are true?()
A.Tag files can only be accessed using a tagdir attribute. B.The sort.jsp page translates successfully and invokes the tag defined by beta.tag. C.The sort.jsp page produces a translation error because a taglib directive must always have a uriattribute. D.Tag files can only be placed in /WEB-INF/tags, and NOT in any subdirectories of /WEB- INF/tags. E.The tagdir attribute in line 2 can be replaced by a uri attribute if a TLD referring to beta.tag is createdand added to the web application.
单项选择题Assume a JavaBean com.example.GradedTestBean exists and has two attributes. The attribute name is oftype java.lang.String and the attribute score is of type java.lang.Integer. An array of com.example. GradedTestBean objects is exposed to the page in a request- scoped attribute called results. Additionally,an empty java.util.HashMap called resultMap is placed in the page scope. A JSP page needs to add the firstentry in results to resultMap, storing the name attribute of the bean as the key and the score attribute of thebean as the value. Which code snippet of JSTL code satisfies this requirement?()
A.${resultMap[results[0].name] = results[0].score} B.<c:set var="${resultMap}" key="${results[0].name}" value="${results[0].score}" /> C.<c:set var="resultMap" property="${results[0].name}"> ${results[0].value}</c:set> D.<c:set var="resultMap" property="${results[0].name}" value="${results[0].score}" /> E.<c:set target="${resultMap}" property="${results[0].name}" value="${results[0].score}" />