A developer wants a web application to be notified when the application is about to be shut down.
Which two actions are necessary to accomplish this goal?()
A.Include a listener directive in a JSP page
B.configure a listener in the TLD file using the
C.Include a
D.configure a listener in the application deployment descriptor, using the
E.Include a class implementing ServletContextListener as part of the web application deploymen
您可能感興趣的試卷
你可能感興趣的試題
Servlet A receives a request that it forwards to servlet B within another web application in the same webcontainer. Servlet A needs to share data with servlet B and that data must not be visible to other servlets inA’s web application.
In which object can the data that A shares with B be stored?()
A.HttpSession
B.ServletConfig
C.ServletContext
D.HttpServletRequest
E.HttpServletResponse
The sl:shoppingList and sl:item tags output a shopping list to the response and are used as follows:
12.<sl:item name="Bread" />
13.<sl:item name="Milk" />
14.<sl:item name="Eggs" />
15.</sl:shoppingList>
The tag handler for sl:shoppingList is ShoppingListTag and the tag handler for sl:item is ItemSimpleTag.ShoppingListTag extends BodyTagSupport and ItemSimpleTag extends SimpleTagSupport.Which is true?()
A.ItemSimpleTag can find the enclosing instance of ShoppingListTag by calling getParent() and castingthe result to ShoppingListTag.
B.ShoppingListTag can find the child instances of ItemSimpleTag by calling super.getChildren() andcasting each to an ItemSimpleTag.
C.It is impossible for ItemSimpleTag and ShoppingListTag to find each other in a tag hierarchy becauseone is a Simple tag and the other is a Classic tag.
D.ShoppingListTag can find the child instances of ItemSimpleTag by calling getChildren() on thePageContext and casting each to an ItemSimpleTag.
E.ItemSimpleTag can find the enclosing instance of ShoppingListTag by calling findAncestorWithClass()on the PageContext and casting the result to ShoppingListTag.
Given the JSP code:
<% request.setAttribute("foo", "bar"); %>and the Classic tag handler code:
5. public int doStartTag() throws JspException {
6. // insert code here
7. // return int
8. }
Assume there are no other "foo" attributes in the web application.
Which invocation on the pageContextobject,inserted at line 6,assigns "bar" to the variable x?()
A.String x = (String) pageContext.getAttribute("foo")
B.String x = (String) pageContext.getRequestScope("foo")
C.It is NOT possible to access the pageContext object from within doStartTag
D.String x = (String) pageContext.getRequest().getAttribute("foo")
E.String x = (String) pageContext.getAttribute("foo", PageContext.ANY_SCOPE)
最新試題
Click the ’Select and Place’ button.Place the events in the order they occur.
Your company has a corporate policy that prohibits storing a customer’s credit card number in anycorporate database. However, users have complained that they do NOT want to re- enter their credit cardnumber for each transaction. Your management has decided to use client-side cookies to record the user’scredit card number for 120 days. Furthermore, they also want to protect this information during transit fromthe web browser to the web container; so the cookie must only be transmitted over HTTPS.Which codesnippet creates the "creditCard" cookie and adds it to the out going response to be stored on the user’s webbrowser?()
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.
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?()
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 is a benefit of precompiling a JSP page?()
Given tutorial.jsp:2.EL Tutorial3.Example 14.5.Dear ${my:nickname(user)}6.Which, when added to the web application deployment descriptor,ensures that line 5 is included verbatimin the JSP output?()