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.
您可能感興趣的試卷
你可能感興趣的試題
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.
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}" />
A.It may iterate over arrays, collections, maps, and strings.
B.The body of the tag may contain EL code, but not scripting code.
C.When looping over collections, a loop status object may be used in the tag body.
D.It may iterate over a map, but only the key of the mapping may be used in the tag body.
E.When looping over integers (for example begin=’1’ end=’10’), a loop status object may not be used inthe tag body.
Click the Exhibit button.
Assuming the tag library in the exhibit is imported with the prefix stock,which custom tag invocation outputsthe contents of the variable exposed by the quote tag?()
A.<;stock:quote&ensp;symbol=";SUNW";&ensp;/>;${var}
B.${var}.&ensp;<;stock:quote&ensp;symbol=";SUNW";&ensp;/>;
C.<;stock:quote&ensp;symbol=";SUNW";>;.&ensp;${var}.&ensp;<;/stock:quote>;
D.<;stock:quote&ensp;symbol=";SUNW";&ensp;var=";quote";&ensp;/>;${quote}
最新試題
Which element of a web application deployment descriptor element is required?()
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?
Which two are valid and equivalent?()
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.
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?()
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?()
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.
Your IT department is building a lightweight Front Controller servlet that invokes an application logic objectwith the interface:public interface ApplicationController {public String invoke(HttpServletRequest request)}The return value of this method indicates a symbolic name of the next view. From this name, the FrontController servlet looks up the JSP URL in a configuration table. This URL might be an absolute path or apath relative to the current request. Next, the Front Controller servlet must send the request to this JSP togenerate the view. Assume that the servlet variable request is assigned the current HttpServletRequestobject and the variable context is assigned the webapp’s ServletContext.Which code snippet of the FrontController servlet accomplishes this goal?()