QUESTION NO: 161
The tl:taskList and tl:task tags output a set of tasks to the response and are used as follows:
11. <tl:taskList>
12. <tl:task name="Mow the lawn" />
13. <tl:task name="Feed the dog" />
14. <tl:task name="Do the laundry" />
15. </tl:taskList>
The tl:task tag supplies information about a single task while the tl:taskList tag does the final
output. The tag handler for tl:taskList is TaskListTag. The tag handler for tl:task is TaskTag. Both
tag handlers extend BodyTagSupport.
Which allows the tl:taskList tag to get the task names from its nested tl:task children?
A. It is impossible for a tag handler that extends BodyTagSupport to communicate with its parent
and child tags.
B. In the TaskListTag.doStartTag method, call super.getChildTags() and iterate through the
results. Cast each result to a TaskTag and call getName().
C. In the TaskListTag.doStartTag method, call getChildTags() on the PageContext and iterate
through the results. Cast each result to a TaskTag and call getName().
D. Create an addTaskName method in TaskListTag. Have the TaskListTag.doStartTag method,
return BodyTag.EVAL_BODY_BUFFERED. In the TaskTag.doStartTag method, call
super.getParent(), cast it to a TaskListTag, and call addTaskName().
E. Create an addTaskName method in TaskListTag. Have the TaskListTag.doStartTag method,
return BodyTag.EVAL_BODY_BUFFERED. In the TaskTag.doStartTag method, call
findAncestorWithClass() on the PageContext, passing TaskListTag as the class to find. Cast the
result to TaskListTag and call addTaskName().
Answer: D
QUESTION NO: 162
Click the Exhibit button.
Given:
10. <form action='create_product.jsp'>
11. Product Name: <input type='text' name='prodName'/><br/>
12. Product Price: <input type='text' name='prodPrice'/><br/>
13. </form>
For a given product instance, which three jsp:setProperty attributes must be used to initialize its
properties from the HTML form? (Choose three.)
A. id
B. name
C. type
D. param
E. property
F. reqParam
G. attribute
Answer: B,D,E
QUESTION NO: 163
Given:
1. package com.example;
2.
3. public abstract class AbstractItem {
4. private String name;
...
13. }
Assume a concrete class com.example.ConcreteItem extends com.example.AbstractItem. A
servlet sets a session-scoped attribute called "item" that is an instance of
com.example.ConcreteItem and then forwards to a JSP page.
Which two are valid standard action invocations that expose a scripting variable to the JSP page?
(Choose two.)
A. <jsp:useBean id="com.example.ConcreteItem"
scope="session" />
B. <jsp:useBean id="item" type="com.example.ConcreteItem"
scope="session" />
C. <jsp:useBean id="item" class="com.example.ConcreteItem"
scope="session" />
D. <jsp:useBean id="item" type="com.example.ConcreteItem"
class="com.example.AbstractItem"
scope="session" />
Answer: B,C
QUESTION NO: 164
Your web application views all have the same header, which includes the <title> tag in the <head>
element of the rendered HTML. You have decided to remove this redundant HTML code from your
JSPs and put it into a single JSP called /WEB-INF/jsp/header.jsp. However, the title of each page
is unique, so you have decided to use a variable called pageTitle to parameterize this in the
header JSP, like this:
10. <title>${param.pageTitle}<title>
Which JSP code snippet should you use in your main view JSPs to insert the header and pass the
pageTitle variable?
A. <jsp:insert page='/WEB-INF/jsp/header.jsp'>
${pageTitle='Welcome Page'}
</jsp:insert>
B. <jsp:include page='/WEB-INF/jsp/header.jsp'>
${pageTitle='Welcome Page'}
</jsp:include>
C. <jsp:include file='/WEB-INF/jsp/header.jsp'>
${pageTitle='Welcome Page'}
</jsp:include>
D. <jsp:insert page='/WEB-INF/jsp/header.jsp'>
<jsp:param name='pageTitle' value='Welcome Page' />
</jsp:insert>
E. <jsp:include page='/WEB-INF/jsp/header.jsp'>
<jsp:param name='pageTitle' value='Welcome Page' />
</jsp:include>
Answer: E
QUESTION NO: 165
Click the Exhibit button.
Given the JSP code:
1. <%
2. pageContext.setAttribute( "product",
3. new com.example.Product( "Pizza", 0.99 ) );
4. %>
5. <%-- insert code here --%>
Which two, inserted at line 5, output the name of the product in the response? (Choose two.)
A. <%= product.getName() %>
B. <jsp:useBean id="product" class="com.example.Product" />
<%= product.getName() %>
C. <jsp:useBean id="com.example.Product" scope="page">
<%= product.getName() %>
</jsp:useBean>
D. <jsp:useBean id="product" type="com.example.Product"
scope="page" />
<%= product.getName() %>
E. <jsp:useBean id="product" type="com.example.Product">
<%= product.getName() %>
</jsp:useBean>
Answer: B,D
QUESTION NO: 166
If you want to use the Java EE platform's built-in type of authentication that uses a custom HTML
page for authentication, which two statements are true? (Choose two.)
A. Your deployment descriptor will need to contain this tag:
<auth-method>CUSTOM</auth-method>.
B. The related custom HTML login page must be named loginPage.html.
C. When you use this type of authentication, SSL is turned on automatically.
D. You must have a tag in your deployment descriptor that allows you to point to both a login
HTML page and an HTML page for handling any login errors.
E. In the HTML related to authentication for this application, you must use predefined variable
names for the variables that store the user and password values.
Answer: D,E
QUESTION NO: 167
Given the two security constraints in a deployment descriptor:
101. <security-constraint>
102. <!--a correct url-pattern and http-method goes here-->
103. <auth-constraint><role-name>SALES</role-name></auth-
103. <auth-constraint>
104. <role-name>SALES</role-name>
105. </auth-constraint>
106. </security-constraint>
107. <security-constraint>
108. <!--a correct url-pattern and http-method goes here-->
109. <!-- Insert an auth-constraint here -->
110. </security-constraint>
If the two security constraints have the same url-pattern and http-method, which two, inserted
independently at line 109, will allow users with role names of either SALES or MARKETING to
access this resource? (Choose two.)
A. <auth-constraint/>
B. <auth-constraint>
<role-name>*</role-name>
</auth-constraint>
C. <auth-constraint>
<role-name>ANY</role-name>
</auth-constraint>
D. <auth-constraint>
<role-name>MARKETING</role-name>
</auth-constraint>
Answer: B,D
QUESTION NO: 168
Which two are valid values for the <transport-guarantee> element inside a <security-constraint>
element of a web application deployment descriptor? (Choose two.)
A. NULL
B. SECURE
C. INTEGRAL
D. ENCRYPTED
E. CONFIDENTIAL
Answer: C,E
QUESTION NO: 169
Which basic authentication type is optional for a J2EE 1.4 compliant web container?
A. HTTP Basic Authentication
B. Form Based Authentication
C. HTTP Digest Authentication
D. HTTPS Client Authentication
Answer: C
QUESTION NO: 170
Which security mechanism uses the concept of a realm?
A. authorization
B. data integrity
C. confidentiality
D. authentication
Answer: D
No comments:
Post a Comment