QUESTION 4 You want to create a filter for your web application and your filter will implement .servlet.Filter. Which two statements are true? (Choose two)

A. Your filter class must implement an init method and a destroy method. B. Your filter class must also implement javax.sarvlat.FilterChain. C. When your filter chains to the next filter, it should pass the same arguments it received in its doFilter method. D. The method that your filter invokes on the object it received that implements javax – servlet.Filterchain can invoke either another filter or a servlet. E. Your filter class must implement a doFilter method that takes, among other things, an HttpServletRequest object and an HttpServletresponse object.

Answer: AD

QUESTION 5 You have a simple wpb application that has a single Front Controller servlet that dispatches to JSPs generate a variety of views. Several of these views require further database processing to retrieve the necessary order object using the orderID request parameter. To do this additional processing, you pass the request first to a servlet that is mapped to the URL pattern /WEB – INF / retrieveOrder.do. in the deployment descriptor. This servlet takes two request parameters, the ordered and the jspID and the jspURL. It handles the database calls to retrieve and build the complex order objects and then it dispatches to the jspURL. Which code snippet in the Front Controller servlet dispatches the request to the order retrieval servlet?

A. the page will include the output false B. the page will include the output C. the page will report that the property roasted does not exist D. the page will report that the syntax of the useBean tag is incorrect E. the page will report that the syntax of the getProperty tag ls incorrect Answer: E

QUESTION 7 A developer chooses to avoid using singieThreadModel but wants to ensure that data If; updated in a thread safe manner. Which two can support this design goal? (Choose two)

A. Store the data in a local variable. B. Store the data in an instance variable. C. Store the data in the Httpsession object. D. Store the data in the sarvletContext object. E. Store the data in the ServletRequest object.

Answer: AE

QUESTION 8 You have a use in your web application that adds several session-scoped attributes. At the end of the use case, one of these objects, the manage attribute, is removed and then it needs to decide which of the other session-scoped attributes to remove. How can this goal be accomplished?

A. The object of the manager attribute should implement the HttpSessionBindingListener and it should call the removeAttribute method on the appropriate session attributes. B. The object of the manager attribute should implement the HttpSessionListenar and it should call the removeAttribute method on the appropriate session attributes. C. The object of the manager attribute should implement the HttpSessionBindingListener rind it should call the deleteAttribute method on the appropriate session attributes. D. The object of the manager attribute should implement the HttpsessionListener and it should call the deleteAttribute method on the appropriate session attributes.

Answer: A

QUESTION 9 The Squeaky Beans Inc. shopping application was initially developed for a non-distributed environment. The company recently purchased the Acme Application Server, which supports distributed Httpsession objects. When deploying the application to the server, the doployer marks it as distributable in the web application deployment descriptor to take advantage of this feature. Given this scenario, which two must be true? (Choose two)

A. The J2EE web container must support migration of objects that implement serializable. B. The J2EE web container must use the native JVM Serialization mechanism for distributing HttpSesaion objects. C. As per the specification, the J2EE web container ensures that distributed Httpsassion objects will be stored in a database. D. Storing references to Enterprise JavaBeans components in the HttpSession object might NOT supported by J2EE web contain.

QUESTION 11 Users of your web application have requested that they should be able to set the duration of their sessions. So for example, one user might want a webapp to stay connected for an hour rather than the webapp’s default of fifteen minutes; another user might want to stay connected for a whole day. Furthermore, you have a special login servlet that performs user authentication and retrieves the object from the database. You want to augment this code to set up the user’s specified session duration. Which code snippet in the login servlet will accomplish this goal?