Which element of the web application deployment descriptor defines the servlet class associated with a servlet instance?
A.
B.
C.
D.
E.
F.
Given a JSP page:
11.
12.
13.
14.
15.
16.
17.
The tag handler for n:recurse extends SimpleTagSupport.
Assuming an n:recurse tag can either contain an empty body or another n:recurse tag, which strategy allows the tag handler for n:recurse to output the nesting depth of the deepest n:recurse tag?
A. It is impossible to determine the deepest nesting depth because it is impossible for tag handlers that extend SimpleTagSupport to communicate with their parent and child tags.
B. Create a private non-static attribute in the tag handler class called count of type int initialized to 0. Increment count in the doTag method. If the tag has a body, invoke the fragment for that body. Otherwise, output the value of count.
C. Start a counter at 1. Call getChildTags(). If it returns null, output the value of the counter. Otherwise, increment counter and continue from where getChildTags() is called. Skip processing of the body.
D. If the tag has a body, invoke the fragment for that body.Otherwise, start a counter at 1. Call getParent (). If it returns null, output the value of the counter Otherwise, increment the counter and continue from where getParent() is called.
You are designing an n-tier Java EE application. You have already decided that some of your JSPs will need to get data from a Customer entity bean. You are trying to decide whether to use a Customer stub object or a Transfer Object. Which two statements are true? (Choose two.)
A. The stub will increase network traffic.
B. The Transfer Object will decrease data staleness.
C. The stub will increase the logic necessary in the JSPs.
D. In both cases, the JSPs can use EL expressions to get data.
E. Only the Transfer Object will need to use a Business Delegate.
F. Using the stub approach allows you to design the application without using a Service Locator.
You want to create a filter for your web application and your filter will implement javax.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.servlet.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.
Which statement is true if the doStartTag method returns EVAL_BODY_BUFFERED ?
A. The tag handler must implement BodyTag.
B. The doAfterBody method is NOT called.
C. The setBodyContent method is called once.
D. It is never legal to return EVAL_BODY_BUFFERED from doStartTag.
Click the Exhibit button. Given the web application deployment descriptor elements:
11.
12.
13.
14.
...
31.
32.
33.
34.
...
55.
56.
57.
58.
What is the result of a client request of the Source servlet with no query string?
A. The output "filterAdded = null" is written to the response stream.
B. The output "filterAdded = addedByFilter" is written to the response stream.
C. An exception is thrown at runtime within the service method of the Source servlet.
D. An exception is thrown at runtime within the service method of the Destination servlet.
Which two statements are true about the security-related tags in a valid Java EE deployment descriptor? (Choose two.)
A. Every
B. A
C. A given
D. A given
E. It is possible to construct a valid
A web application uses the HttpSession mechanism to determine if a user is "logged in." When a user supplies a valid user name and password, an HttpSession is created for that user.
The user has access to the application for only 15 minutes after logging in. The code must determine how long the user has been logged in, and if this time is greater than 15 minutes, must destroy the HttpSession. Which method in HttpSession is used to accomplish this?
A. getCreationTime
B. invalidateAfter
C. getLastAccessedTime
D. getMaxInactiveInterval
Which two are valid and equivalent? (Choose two.)
A. <%! int i; %>
B. <%= int i; %>
C.
D.
E.
Given that a web application consists of two HttpServlet classes, ServletA and ServletB, and the ServletA.service method:
20.
String key = "com.example.data";
21.
session.setAttribute(key, "Hello");
22.
Object value = session.getAttribute(key);
23.
Assume session is an HttpSession, and is not referenced anywhere else in ServletA.
Which two changes, taken together, ensure that value is equal to "Hello" on line 23? (Choose two.)
A. ensure that the ServletB.service method is synchronized
B. ensure that the ServletA.service method is synchronized
C. ensure that ServletB synchronizes on the session object when setting session attributes
D. enclose lines 21-22 in a synchronized block:synchronized(this) {session.setAttribute(key, "Hello");value = session.getAttribute(key);}
E. enclose lines 21-22 in a synchronized block:synchronized(session) {session.setAttribute(key, "Hello");value = session.getAttribute(key);}