최신SUN Sun Certified Web Component Developer for J2EE 5 - 310-083무료샘플문제
As a convenience feature, your web pages include an Ajax request every five minutes to a special servlet that monitors the age of the user's session. The client-side JavaScript that handles the Ajax callback displays a message on the screen as the session ages. The Ajax call does NOT pass any cookies, but it passes the session ID in a request parameter called sessionID. In addition, assume that your webapp keeps a hashmap of session objects by the ID. Here is a partial implementation of this servlet:
10. public class SessionAgeServlet extends HttpServlet {
11. public void service(HttpServletRequest request, HttpServletResponse) throws
IOException {
1 2. String sessionID = request.getParameter("sessionID");
1 3. HttpSession session = getSession(sessionID);
1 4. long age = // your code here
1 5. response.getWriter().print(age);
1 6. }
... // more code here
4 7. }
Which code snippet on line 14, will determine the age of the session?
To take advantage of the capabilities of modern browsers that use web standards, such as
XHTML and CSS, your web application is being converted from simple JSP pages to JSP
Document format. However, one of your JSPs, /scripts/screenFunctions.jsp, generates a
JavaScript file. This file is included in several web forms to create screen-specific validation functions and are included in these pages with the following statement:
1 0. <head>
1 1. <script src='/scripts/screenFunctions.jsp'
1 2. language='javascript'
1 3. type='application/javascript'> </script>
1 4. </head>
1 5. <!-- body of the web form -->
Which JSP code snippet declares that this JSP Document is a JavaScript file?
You need to store a Java long primitive attribute, called customerOID, into the session scope. Which two code snippets allow you to insert this value into the session? (Choose two.)
Given an EL function foo, in namespace func, that requires a long as a parameter and returns a Map, which two are valid invocations of function foo? (Choose two.)
You are creating an error page that provides a user-friendly screen whenever a server exception occurs. You want to hide the stack trace, but you do want to provide the exception's error message to the user so the user can provide it to the customer service agent at your company. Which EL code snippet inserts this error message into the error page?
Your web site has many user-customizable features, for example font and color preferences on web pages. Your IT department has already built a subsystem for user preferences using Java SE's lang.util.prefs package APIs and you have been ordered to reuse this subsystem in your web application. You need to create an event listener that stores the user's Preference object when an HTTP session is created. Also, note that user identification information is stored in an HTTP cookie.
Which partial listener class can accomplish this goal?
You need to store a floating point number, called Tsquare, in the session scope. Which two code snippets allow you to retrieve this value? (Choose two.)
Which two prevent a servlet from handling requests? (Choose two.)
Given an HttpServletRequest request and HttpServletResponse response, which sets a cookie "username" with the value "joe" in a servlet?
Which security mechanism uses the concept of a realm?
A developer is designing a web application which extensively uses EJBs and JMS. The developer finds that there is a lot of duplicated code to build the JNDI contexts to access the beans and queues. Further, because of the complexity, there are numerous errors in the code. Which J2EE design pattern provides a solution for this problem?