Oracle Java Enterprise Edition 5 Web Component Developer Certified Professional (1Z0-858) Free Practice Test
Question 1
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?
Which JSP code snippet should you use in your main view JSPs to insert the header and pass the pageTitle variable?
Correct Answer: B
Question 2
You want to create a valid directory structure for your Java EE web application, and your application uses tag files and a JAR file. Which three must be located directly in your WEBINF directory (NOT in a subdirectory of WEB-INF)? (Choose three.)
Correct Answer: B,C,D
Question 3
A developer is designing a web application that must support multiple interfaces, including:
an XML web service for B2B HTML for web-based clients WML for wireless customers
Which design pattern provides a solution for this problem?
an XML web service for B2B HTML for web-based clients WML for wireless customers
Which design pattern provides a solution for this problem?
Correct Answer: B
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: A,B,D,F
Question 5
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 6
Which security mechanism uses the concept of a realm?
Correct Answer: B
Question 7
Given:
String value = getServletContext().getInitParameter("foo");
in an HttpServlet and a web application deployment descriptor that contains:
<context-param>
<param-name>foo</param-name>
<param-value>frodo</param-value>
</context-param>
Which two are true? (Choose two.)
String value = getServletContext().getInitParameter("foo");
in an HttpServlet and a web application deployment descriptor that contains:
<context-param>
<param-name>foo</param-name>
<param-value>frodo</param-value>
</context-param>
Which two are true? (Choose two.)
Correct Answer: C,F
Question 8
Given:
6.<myTag:foo bar='42'>
7.<%="processing" %>
8.</myTag:foo>
and a custom tag handler for foo which extends TagSupport.
Which two are true about the tag handler referenced by foo? (Choose two.)
6.<myTag:foo bar='42'>
7.<%="processing" %>
8.</myTag:foo>
and a custom tag handler for foo which extends TagSupport.
Which two are true about the tag handler referenced by foo? (Choose two.)
Correct Answer: C,E
Question 9
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: A,B,D,F
Question 10
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.)
whether to use a Customer stub object or a Transfer Object. Which two statements are true? (Choose two.)
Correct Answer: C,F
Question 11
You have built a web application that you license to small businesses. The webapp uses a context parameter, called licenseExtension, which enables certain advanced features based on your client's license package. When a client pays for a specific service, you provide them with a license extension key that they insert into the <context-param> of the deployment descriptor. Not every client will have this context parameter so you need to create a context listener to set up a default value in the licenseExtension parameter. Which code snippet will accomplish this goal?
Correct Answer: A
Question 12
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.)
Correct Answer: C,F
Question 13
A developer wants a web application to be notified when the application is about to be shut down. Which two actions are necessary to accomplish this goal? (Choose two.)
Correct Answer: F,G