Assume that a news tag library contains the tags lookup and item: lookup Retrieves the latest news headlines and executes the tag body once for each headline. Exposes a NESTED page scoped attributecalled headline of type com.example.Headline containing details for that headline. item Outputs the HTMLfor a single news headline. Accepts an attribute info of typecom.example.Headline containing details for theheadline to be rendered.
Which snippet of JSP code returns the latest news headlines in an HTML table,one per row?()
A.
B.
C.
D.
您可能感興趣的試卷
你可能感興趣的試題
One of the use cases in your web application uses many session-scoped attributes. At the end of the usecase, you want to clear out this set of attributes from the session object. Assume that this static variableholds this set of attribute names:
201.private static final Set<String> USE_CASE_ATTRS;
202.static {
203.USE_CASE_ATTRS.add("customerOID");
204.USE_CASE_ATTRS.add("custMgrBean");
205.USE_CASE_ATTRS.add("orderOID");
206.USE_CASE_ATTRS.add("orderMgrBean");
207.}
Which code snippet deletes these attributes from the session object?()
A.session.removeAll(USE_CASE_ATTRS);
B.for( String attr : USE_CASE_ATTRS ){ session.remove(attr); }
C.for( String attr : USE_CASE_ATTRS ){session.removeAttribute(attr);}
D.for( String attr : USE_CASE_ATTRS ){session.deleteAttribute(attr);}
E.session.deleteAllAttributes(USE_CASE_ATTRS);
A.Access to session-scoped attributes is guaranteed to be thread-safe by the web container.
B.To activate URL rewriting, the developer must use the HttpServletResponse.setURLRewriting method.
C.If the web application uses HTTPS, then the web container may use the data on the HTTPS request stream to identify the client.
D.The JSESSIONID cookie is stored permanently on the client so that a user may return to the web application and the web container will rejoin that session.
Your web application requires the adding and deleting of many session attributes during a complex usecase. A bug report has come in that indicates that an important session attribute is being deleted too soonand a NullPointerException is being thrown several interactions after the fact. You have decided to create asession event listener that will log when attributes are being deleted so you can track down when theattribute is erroneously being deleted.
Which listener class will accomplish this debugging goal?()
A.Create an HttpSessionAttributeListener class and implement the attributeDeleted method and log the attribute name using the getName method on the event object.
B.Create an HttpSessionAttributeListener class and implement the attributeRemoved method and log the attribute name using the getName method on the event object.
C.Create an SessionAttributeListener class and implement the attributeRemoved method and log the attribute name using the getAttributeName method on the event object.
D.Create an SessionAttributeListener class and implement the attributeDeleted method and log the attribute name using the getAttributeName method on the event object.
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?()
A.long customerOID = 47L;session.setAttribute("customerOID", new Long(customerOID));
B.long customerOID = 47L;session.setLongAttribute("customerOID", new Long(customerOID));
C.long customerOID = 47L;session.setAttribute("customerOID", customerOID);
D.long customerOID = 47L;session.setNumericAttribute("customerOID", new Long(customerOID));
Given the definition of MyServlet:
11.public class MyServlet extends HttpServlet {
12.public void service(HttpServletRequest request,
13.HttpServletResponse response)
14.throws ServletException, IOException {
15.HttpSession session = request.getSession();
16.session.setAttribute("myAttribute","myAttributeValue");
17.session.invalidate();
18.response.getWriter().println("value=" +
19.session.getAttribute("myAttribute"));
20.}
21.}
What is the result when a request is sent to MyServlet?()
A.An IllegalStateException is thrown at runtime.
B.An InvalidSessionException is thrown at runtime.
C.The string "value=null" appears in the response stream.
D.The string "value=myAttributeValue" appears in the response stream.
最新試題
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.
Which element of a web application deployment descriptor element is required?()
Which is a benefit of precompiling a JSP page?()
The JSP developer wants a comment to be visible in the final output to the browser.Which comment styleneeds to be used in a JSP page?()
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?
In which three directories, relative to a web application’s root, may a tag library descriptor file reside whendeployed directly into a web application?()
Which two are valid and equivalent?()
You are building a dating service web site. Part of the form to submit a client’s profile is a groupIIof radio buttons for the person’s hobbies:20.<input type=’radio’ name=’hobbyEnum’ value=’HIKING’>Hiking <br>21.<input type=’radio’ name=’hobbyEnum’ value=’SKIING’>Skiing <br>22.<input type=’radio’ name=’hobbyEnum’ value=’SCUBA’>SCUBA Diving23.<!-- and more options -->After the user submits this form, a confirmation screen is displayed with these hobbies listed. Assume thatan application-scoped variable, hobbies, holds a map between the Hobby enumerated type and the displayname.Which EL code snippet will display Nth element of the user’s selected hobbies?()