Oracle Java Enterprise Edition 5 Web Component Developer Certified Professional - 1Z0-858 Exam Practice Test
Question 1
Given:
3.public class MyTagHandler extends TagSupport {
4.public int doStartTag() {
5.// insert code here
6.// return an int
7.}
8.// more code here
...
18. }
There is a single attribute foo in the session scope.
Which three code fragments, inserted independently at line 5, return the value of the attribute? (Choose three.)
3.public class MyTagHandler extends TagSupport {
4.public int doStartTag() {
5.// insert code here
6.// return an int
7.}
8.// more code here
...
18. }
There is a single attribute foo in the session scope.
Which three code fragments, inserted independently at line 5, return the value of the attribute? (Choose three.)
Correct Answer: B,C,E
Question 2
DRAG DROP
Click the Task button.
Place the code snippets in the proper order to construct the JSP code to import static content into a JSP page at translation-time.

Click the Task button.
Place the code snippets in the proper order to construct the JSP code to import static content into a JSP page at translation-time.

Correct Answer:

Question 3
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.)
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.)
Correct Answer: A,C
Question 4
Given:
3.class MyServlet extends HttpServlet {
4.public void doPut(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
5.// servlet code here ...
26.
}
27.
}
If the DD contains a single security constraint associated with MyServlet and its only <httpmethod> tags and <auth-constraint> tags are:
<http-method>GET</http-method> <http-method>PUT</http-method> <auth-constraint>Admin</auth-constraint>
Which four requests would be allowed by the container? (Choose four.)
3.class MyServlet extends HttpServlet {
4.public void doPut(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
5.// servlet code here ...
26.
}
27.
}
If the DD contains a single security constraint associated with MyServlet and its only <httpmethod> tags and <auth-constraint> tags are:
<http-method>GET</http-method> <http-method>PUT</http-method> <auth-constraint>Admin</auth-constraint>
Which four requests would be allowed by the container? (Choose four.)
Correct Answer: B,C,D,E
Question 5
Which interface must a session attribute implement if it needs to be notified when a web container persists a session?
Correct Answer: C
Question 6
In which three directories, relative to a web application's root, may a tag library descriptor file reside when deployed directly into a web application? (Choose three.)
Correct Answer: A,D,E
Question 7
You are building a web application that will be used throughout the European Union; therefore, it has significant internationalization requirements. You have been tasked to create a custom tag that generates a message using the java.text.MessageFormat class. The tag will take the resourceKey attribute and a variable number of argument attributes with the format, arg<N>. Here is an example use of this tag and its output:
<t:message resourceKey='diskFileMsg' arg0='MyDisk' arg1='1247' />
generates:
The disk "MyDisk" contains 1247 file(s).
Which Simple tag class definition accomplishes this goal of handling a variable number of tag attributes?
<t:message resourceKey='diskFileMsg' arg0='MyDisk' arg1='1247' />
generates:
The disk "MyDisk" contains 1247 file(s).
Which Simple tag class definition accomplishes this goal of handling a variable number of tag attributes?
Correct Answer: C
Question 8
A developer is designing the presentation tier for a web application which requires a centralized request handling to complete common processing required by each request. Which design pattern provides a solution to this problem?
Correct Answer: E
Question 9
Click the Exhibit button.
The attribute "name" has a value of "Foo,"
What is the result if this tag handler's tag is invoked?

The attribute "name" has a value of "Foo,"
What is the result if this tag handler's tag is invoked?

Correct Answer: F
Question 10
For a given ServletResponse response, which two retrieve an object for writing text data?
(Choose two.)
(Choose two.)
Correct Answer: C,E
Question 11
DRAG DROP
Click the Task button.
Given a servlet mapped to /control, place the correct URI segment returned as a String on the corresponding HttpServletRequest method call for the URI: /myapp/control/processorder.

Click the Task button.
Given a servlet mapped to /control, place the correct URI segment returned as a String on the corresponding HttpServletRequest method call for the URI: /myapp/control/processorder.

Correct Answer:

Question 12
Which element of the web application deployment descriptor defines the servlet class associated with a servlet instance?
Correct Answer: D
Question 13
You want to create a valid directory structure for your Java EE web application, and you want to put your web application into a WAR file called MyApp.war. Which two are true about the WAR file? (Choose two.)
Correct Answer: A,C

