Sunday, January 11, 2015

SCJP Sun Certified Programmer for Java 6 Study Guide: Exam 310-065 



Description


SCJP Sun Certified Programmer for Java 6 Study Guide covers what you need to know--and shows you how to prepare--for this challenging exam.
100% complete coverage of all official objectives for exam 310-065
Exam Objective Highlights in every chapter point out certification objectives to ensure you're focused on passing the exam Exam Watch sections in every chapter highlight key exam topics covered Simulated exam questions match the format, tone, topics, and difficulty of the real exam.




Book details


  • Publisher: McGraw Hill Education
  • By: Kathy Sierra, Bert Bates
  • ISBN: 978-0071591065
  • Year: 2008
  • Pages: 851 pages
  • Language: English
  • Size: 2.95 MB
  • File Format: PDF

eBook

     



Oracle Certified Professional Java SE7 Programmer Exams 1Z0-804 and 1Z0-805: A Comprehensive OCPJP 7 Certification Guide: A Comprehensive OCPJP 7 Certification Guide 



Description


Oracle Certified Professional Java SE7 Programmer Exams 1Z0-804 and 1Z0-805: a Comprehensive OCPJP 7 Certification Guide is a book of aspirants who wish to take the Oracle Certified Professional Java SE7 Programmer Exams. It contains in-depth details and explanations of the 13 topic syllabus.






Book details


  • Publisher: APress
  • By: S.G.Ganesh, Tushar Sharma
  • ISBN: 978-1430247647
  • Year: 2013
  • Pages: 656 pages
  • Language: English
  • Size: 5.73 MB
  • File Format: PDF

eBook

     



OCA/OCP Java SE 7 Programmer I & II Study Guide (Exams 1Z0-803 & 1Z0-804)



Description


OCA/OCP Java SE 7 Programmer I and II exams with this exclusive Oracle Press guide. Chapters feature challenging exercises, a certification summary, a two-minute drill, and a self-test to reinforce the topics presented. This authoritative resource helps you pass these exams and also serves as an essential, on-the-job reference.
Oracle Certified Professional Java SE7 Programmer Exams 1Z0-804 and 1Z0-805: a Comprehensive OCPJP 7 Certification Guide is a book that makes sure you have an all round preparation for the relevant examinations. 


Book details


  • Publisher: McGraw Hill Education
  • By: Kathy Sierra, Bert Bates
  • ISBN: 978-0071772006
  • Year: 2014
  • Pages: 888 pages
  • Language: English
  • Size: 6.73 MB
  • File Format: PDF

eBook

     



Scwcd Exam Study Kit: Java Web Component Developer Certification



Description


Java developers, Servlet/JSP developers, and J2EE developers pass the Sun Certified Web Component Developer Exam (SCWCD 310-081), this study guide covers all aspects of the Servlet and JSP technology that Sun has determined necessary. This new edition adds aspects of servlet/JSP development, such as the Expression language, and updated materials of servlets with a particular focus on using filters to make request processing more efficient. Covering the reliance on the JSP Standard Template Library (JSTL) and its core, this guide allows JSP developers will be able to simplify their development process and remove Java-based scriptlets and expressions from their code. All applications in this book are designed to run on Apache's latest development server, Tomcat 5.0, and instructions on how to install this new edition and execute servlets and JSPs are included.


Book details


  • Publisher: Manning Publications
  • By: Hanumant Deshmukh, Jignesh Malavia, Matthew Scarpino
  • ISBN: 978-1932394382
  • Year: 2005
  • Pages: 531 pages
  • Language: English
  • Size: 4.53 MB
  • File Format: PDF

eBook

     

Saturday, January 10, 2015

Java EE 5 Certification






Exam Topics


Section 1: The Servlet Technology Model
  • For each of the HTTP Methods (such as GET, POST, HEAD, and so on) describe the purpose of the method and the technical characteristics of the HTTP Method protocol, list triggers that might cause a Client (usually a Web browser) to use the method; and identify the HttpServlet method that corresponds to the HTTP Method.
  • Using the HttpServletRequest interface, write code to retrieve HTML form parameters from the request, retrieve HTTP request header information, or retrieve cookies from the request.
  • Using the HttpServletResponse interface, write code to set an HTTP response header, set the content type of the response, acquire a text stream for the response, acquire a binary stream for the response, redirect an HTTP request to another URL, or add cookies to the response.
  • Describe the purpose and event sequence of the servlet life cycle: (1) servlet class loading, (2) servlet instantiation, (3) call the init method, (4) call the service method, and (5) call destroy method.
Section 2: The Structure and Deployment of Web Applications
  • Construct the file and directory structure of a Web Application that may contain (a) static content, (b) JSP pages, (c) servlet classes, (d) the deployment descriptor, (e) tag libraries, (d) JAR files, and (e) Java class files; and describe how to protect resource files from HTTP access.
  • Describe the purpose and semantics of the deployment descriptor.
  • Construct the correct structure of the deployment descriptor.
  • Explain the purpose of a WAR file and describe the contents of a WAR file, how one may be constructed.
Section 3: The Web Container Model
  • For the ServletContext initialization parameters: write servlet code to access initialization parameters; and create the deployment descriptor elements for declaring initialization parameters.
  • For the fundamental servlet attribute scopes (request, session, and context): write servlet code to add, retrieve, and remove attributes; given a usage scenario, identify the proper scope for an attribute; and identify multi-threading issues associated with each scope.
  • Describe the Web container request processing model; write and configure a filter; create a request or response wrapper; and given a design problem, describe how to apply a filter or a wrapper.
  • Describe the Web container life cycle event model for requests, sessions, and web applications;create and configure listener classes for each scope life cycle; create and configure scope attribute listener classes; and given a scenario, identify the proper attribute listener to use.
  • Describe the RequestDispatcher mechanism; write servlet code to create a request dispatcher; write servlet code to forward or include the target resource; and identify and describe the additional request-scoped attributes provided by the container to the target resource.
Section 4: Session Management
  • Write servlet code to store objects into a session object and retrieve objects from a session object.
  • Given a scenario describe the APIs used to access the session object, explain when the session object was created, and describe the mechanisms used to destroy the session object, and when it was destroyed.
  • Using session listeners, write code to respond to an event when an object is added to a session, and write code to respond to an event when a session object migrates from one VM to another.
  • Given a scenario, describe which session management mechanism the Web container could employ, how cookies might be used to manage sessions, how URL rewriting might be used to manage sessions, and write servlet code to perform URL rewriting.
Section 5: Web Application Security
  • Based on the servlet specification, compare and contrast the following security mechanisms: (a) authentication, (b) authorization, (c) data integrity, and (d) confidentiality.
  • In the deployment descriptor, declare a security constraint, a Web resource, the transport guarantee, the login configuration, and a security role.
  • Compare and contrast the authentication types (BASIC, DIGEST, FORM, and CLIENT-CERT); describe how the type works; and given a scenario, select an appropriate type.
Section 6: The JavaServer Pages (JSP) Technology Model
  • Identify, describe, or write the JSP code for the following elements: (a) template text, (b) scripting elements (comments, directives, declarations, scriptlets, and expressions), (c) standard and custom actions, and (d) expression language elements.
  • Write JSP code that uses the directives: (a) 'page' (with attributes 'import', 'session', 'contentType', and 'isELIgnored'), (b) 'include', and (c) 'taglib'.
  • Write a JSP Document (XML-based document) that uses the correct syntax.
  • Describe the purpose and event sequence of the JSP page life cycle: (1) JSP page translation, (2) JSP page compilation, (3) load class, (4) create instance, (5) call the jspInit method, (6) call the _jspService method, and (7) call the jspDestroy method.
  • Given a design goal, write JSP code using the appropriate implicit objects: (a) request, (b) response, (c) out, (d) session, (e) config, (f) application, (g) page, (h) pageContext, and (i) exception.
  • Configure the deployment descriptor to declare one or more tag libraries, deactivate the evaluation language, and deactivate the scripting language. 6.7 Given a specific design goal for including a JSP segment in another page, write the JSP code that uses the most appropriate inclusion mechanism (the include directive or the jsp:include standard action).
Section 7: Building JSP Pages Using the Expression Language (EL)
  • Given a scenario, write EL code that accesses the following implicit variables including pageScope, requestScope, sessionScope, and applicationScope, param and paramValues, header and headerValues, cookie, initParam and pageContext.
  • Given a scenario, write EL code that uses the following operators: property access (the . operator), collection access (the [] operator).
Section 8: Building JSP Pages Using Standard Actions
  • Given a design goal, create a code snippet using the following standard actions: jsp:useBean (with attributes: 'id', 'scope', 'type', and 'class'), jsp:getProperty, jsp:setProperty (with all attribute combinations), and jsp:attribute.
  • Given a design goal, create a code snippet using the following standard actions: jsp:include, jsp:forward, and jsp:param.
Section 9: Building JSP Pages Using Tag Libraries
  • For a custom tag library or a library of Tag Files, create the 'taglib' directive for a JSP page.
  • Given a design goal, create the custom tag structure in a JSP page to support that goal.
  • Given a design goal, use an appropriate JSP Standard Tag Library (JSTL v1.1) tag from the "core" tag library.
Section 10: Building a Custom Tag Library
  • Describe the semantics of the "Classic" custom tag event model when each event method (doStartTag, doAfterBody, and doEndTag) is executed, and explain what the return value for each event method means; and write a tag handler class.
  • Using the PageContext API, write tag handler code to access the JSP implicit variables and access web application attributes.
  • Given a scenario, write tag handler code to access the parent tag and an arbitrary tag ancestor.
  • Describe the semantics of the "Simple" custom tag event model when the event method (doTag) is executed; write a tag handler class; and explain the constraints on the JSP content within the tag.
  • Describe the semantics of the Tag File model; describe the web application structure for tag files; write a tag file; and explain the constraints on the JSP content in the body of the tag.
Section 11: Java EE Patterns
  • Given a scenario description with a list of issues, select a pattern that would solve the issues. The list of patterns you must know are: Intercepting Filter, Model-View-Controller, Front Controller, Service Locator, Business Delegate, and Transfer Object.
  • Match design patterns with statements describing potential benefits that accrue from the use of the pattern, for any of the following patterns: Intercepting Filter, Model-View-Controller, Front Controller, Service Locator, Business Delegate, and Transfer Object.

Java SE 6 Certification






Exam Topics


Section 1: Declarations, Initialization and Scoping
  • Develop code that declares classes (including abstract and all forms of nested classes), interfaces, and enums, and includes the appropriate use of package and import statements (including static imports).
  • Develop code that declares an interface. Develop code that implements or extends one or more interfaces.
  • Develop code that declares an abstract class. Develop code that extends an abstract class.
  • Develop code that declares, initializes, and uses primitives, arrays, enums, and objects as static, instance, and local variables. Also, use legal identifiers for variable names.
  • Given a code example, determine if a method is correctly overriding or overloading another method, and identify legal return values (including covariant returns), for the method.
  • Given a set of classes and superclasses, develop constructors for one or more of the classes. Given a class declaration, determine if a default constructor will be created, and if so, determine the behavior of that constructor. Given a nested or non-nested class listing, write code to instantiate the class.
Section 2: Flow Control
  • Develop code that implements an if or switch statement; and identify legal argument types for these statements.
  • Develop code that implements all forms of loops and iterators, including the use of for, the enhanced for loop (for-each), do, while, labels, break, and continue; and explain the values taken by loop counter variables during and after loop execution.
  • Develop code that makes use of assertions, and distinguish appropriate from inappropriate uses of assertions.
  • Develop code that makes use of exceptions and exception handling clauses (try, catch, finally), and declares methods and overriding methods that throw exceptions.
  • Recognize the effect of an exception arising at a specified point in a code fragment. Note that the exception may be a runtime exception, a checked exception, or an error.
  • Recognize situations that will result in any of the following being thrown: ArrayIndexOutOfBoundsException,ClassCastException, IllegalArgumentException, IllegalStateException, NullPointerException, NumberFormatException, AssertionError, ExceptionInInitializerError, StackOverflowError or NoClassDefFoundError. Understand which of these are thrown by the virtual machine and recognize situations in which others should be thrown programatically.
Section 3: API Contents
  • Develop code that uses the primitive wrapper classes (such as Boolean, Character, Double, Integer, etc.), and/or autoboxing & unboxing. Discuss the differences between the String, StringBuilder, and StringBuffer classes.
  • Given a scenario involving navigating file systems, reading from files, writing to files, or interacting with the user, develop the correct solution using the following classes (sometimes in combination), from java.io: BufferedReader, BufferedWriter, File, FileReader, FileWriter, PrintWriter, and Console.
  • Use standard J2SE APIs in the java.text package to correctly format or parse dates, numbers, and currency values for a specific locale; and, given a scenario, determine the appropriate methods to use if you want to use the default locale or a specific locale. Describe the purpose and use of the java.util.Locale class.
  • Write code that uses standard J2SE APIs in the java.util and java.util.regex packages to format or parse strings or streams. For strings, write code that uses the Pattern and Matcher classes and the String.split method. Recognize and use regular expression patterns for matching (limited to: . (dot), * (star), + (plus), ?, \d, \s, \w, [], ()). The use of *, +, and ? will be limited to greedy quantifiers, and the parenthesis operator will only be used as a grouping mechanism, not for capturing content during matching. For streams, write code using the Formatter and Scanner classes and the PrintWriter.format/printf methods. Recognize and use formatting parameters (limited to: %b, %c, %d, %f, %s) in format strings.
Section 4: Concurrency
  • Write code to define, instantiate, and start new threads using both java.lang.Thread and java.lang.Runnable.
  • Recognize the states in which a thread can exist, and identify ways in which a thread can transition from one state to another.
  • Given a scenario, write code that makes appropriate use of object locking to protect static or instance variables from concurrent access problems.
Section 5: OO Concepts
  • Develop code that implements tight encapsulation, loose coupling, and high cohesion in classes, and describe the benefits.
  • Given a scenario, develop code that demonstrates the use of polymorphism. Further, determine when casting will be necessary and recognize compiler vs. runtime errors related to object reference casting.
  • Explain the effect of modifiers on inheritance with respect to constructors, instance or static variables, and instance or static methods.
  • Given a scenario, develop code that declares and/or invokes overridden or overloaded methods and code that declares and/or invokes superclass, or overloaded constructors.
  • Develop code that implements "is-a" and/or "has-a" relationships.
Section 6: Collections / Generics
  • Given a design scenario, determine which collection classes and/or interfaces should be used to properly implement that design, including the use of the Comparable interface.
  • Distinguish between correct and incorrect overrides of corresponding hashCode and equals methods, and explain the difference between == and the equals method.
  • Write code that uses the generic versions of the Collections API, in particular, the Set, List, and Map interfaces and implementation classes. Recognize the limitations of the non-generic Collections API and how to refactor code to use the generic versions. Write code that uses the NavigableSet and NavigableMap interfaces.
  • Develop code that makes proper use of type parameters in class/interface declarations, instance variables, method arguments, and return types; and write generic methods or methods that make use of wildcard types and understand the similarities and differences between these two approaches.
  • Use capabilities in the java.util package to write code to manipulate a list by sorting, performing a binary search, or converting the list to an array. Use capabilities in the java.util package to write code to manipulate an array by sorting, performing a binary search, or converting the array to a list. Use the java.util.Comparator and java.lang.Comparable interfaces to affect the sorting of lists and arrays. Furthermore, recognize the effect of the "natural ordering" of primitive wrapper classes and java.lang.String on sorting.
Section 7: Fundamentals
  • Given a code example and a scenario, write code that uses the appropriate access modifiers, package declarations, and import statements to interact with (through access or inheritance) the code in the example.
  • Given an example of a class and a command-line, determine the expected runtime behavior.
  • Determine the effect upon object references and primitive values when they are passed into methods that perform assignments or other modifying operations on the parameters.
  • Given a code example, recognize the point at which an object becomes eligible for garbage collection, determine what is and is not guaranteed by the garbage collection system, and recognize the behaviors of the Object.finalize() method.
  • Given the fully-qualified name of a class that is deployed inside and/or outside a JAR file, construct the appropriate directory structure for that class. Given a code example and a classpath, determine whether the classpath will allow the code to compile successfully.
  • Write code that correctly applies the appropriate operators including assignment operators (limited to: =, +=, -=), arithmetic operators (limited to: +, -, *, /, %, ++, --), relational operators (limited to: <, <=, >, >=, ==, !=), the instanceof operator, logical operators (limited to: &, |, ^, !, &&, ||), and the conditional operator ( ? : ), to produce a desired result. Write code that determines the equality of two objects or two primitives.

WHAT IS OCJP?


     Oracle Certified Java Programmer or OCJP certification is a dignified recognition for an individual possessing the knowledge of java programming. Popular by name Sun Certified Java Programmer or SCJP, the OCJP certification has got its name as Oracle Corporation took over Sun Microsystems. The Java certifications that were earlier called with the name of Sun started being called with the name of Oracle.

IMPORTANCE OF CERTIFICATION:  


  •    OCJP certification is meant for the Java programmers and hence is very useful for an individual having sound knowledge of the programming concepts. 
  •    Certification can play a valuable role during the initial career phase of an individual when he/she is seeking to enter the IT field for becoming a programmer/developer. This will be a credit for a programmer and thereby will increase his/her chances to be recognized by the employers for better job opportunities. 
  •    Certification will prove the worth of an individual as a person with good knowhow of development concepts using this web development language. Hence, as a fresher looking for job as a programmer, one should definitely try for OCJP certification exam.

WHAT IS OCWCD?


     The Oracle Certified Web Component Developer (OCWCD 5.0) for J2EE Platform certification exam. Popular by name Sun Certified Web Component Developer or SCWCD, the OCWCD certification has got its name as Oracle Corporation took over Sun Microsystems. Oracle Certified Programmers who are using the Java technology servlet and JavaServer Pages (JSP) application program interface (APIs) to develop Web applications. Prior to beginning the Oracle Certified Web Component Developer program, you must be a Oracle Certified Java Programmer(OCJP) for the Java platform (any edition).

IMPORTANCE OF CERTIFICATION: 


  •    OCWCD 5.0 certification proves your expertise on the Oracle Java products and technologies. Professionals holding the OCWCD certification are preferred by the employers and they also get preference in promotions. 
  •    OCWCD certification is helpful for professionals who want to upgrade their credentials and get recognition from the IT industry. 
  •    OCWCD certification proves your expertise on the Oracle Java web components and technologies to get paid more.

Wednesday, January 7, 2015

SCWCD Questions And Answers Part 6

Q: 151 Click the Task button.


Place the code snippets in the proper order to construct the JSP code to include dynamic content into a JSP page at request-time.


Answer: Check ExamWorx eEngine, Download from Member Center


Q: 152 Given:

6.  <% int[] nums = {42, 420, 4200};

7.        request.setAttribute("foo", nums); %>

Which two successfully translate and result in a value of true? (Choose two.)

A. ${true or false}
B. ${requestScope[foo][0] > 500}
C. ${requestScope['foo'][1] = 420}
D. ${(requestScope['foo'][0] lt 50) && (3 gt 2)}

Answer: A, D


Q: 153 Click the Exhibit button.
Given:

11.  <% com.example.Advisor advisor = new com.example.Advisor(); %>

12.  <% request.setAttribute("foo", advisor); %>
Assuming there are no other "foo" attributes in the web application, which three are valid EL expressions for retrieving the advice property of advisor? (Choose three.)


A. ${foo.advice}
B. ${request.foo.advice}
C. ${requestScope.foo.advice}
D. ${requestScope[foo[advice]]}
E. ${requestScope["foo"]["advice"]}
F. ${requestScope["foo"["advice"]]}
  
Answer: A, C, E


Q: 154 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?

A. Message: <b>${exception.message}</b> 
B. Message: <b>${exception.errorMessage}</b>
C. M essage: <b>${request.exception.message}</b>
D. Message: <b>${pageContext.exception.message}</b>
E. Message: <b>${request.exception.errorMessage}</b>
F. Message: <b>${pageContext.exception.errorMessage}</b> 

Answer: D


Q: 155 You are building a dating web site. The client's date of birth is collected along with lots of other information. You have created an EL function with the signature: calcAge(java.util.Date):int and it is assigned to the name, age, in the namespace, funct. In one of your JSPs you need to print a special message to clients who are younger than 25. Which EL code snippet will return true for this condition?

A. ${calcAge(client.birthDate) < 25}
B. ${calcAge[client.birthDate] < 25}
C. ${funct:age(client.birthDate) < 25}
D. ${funct:age[client.birthDate] < 25}
E. ${funct:calcAge(client.birthDate) < 25}
F. ${funct:calcAge[client.birthDate] < 25} 

Answer: C


Q: 156 Given:

11.  <% java.util.Map map = new java.util.HashMap();

12.        request.setAttribute("map", map);
13.        map.put("a", "b");
14.        map.put("b", "c");
15.        map.put("c", "d"); %>
16.  <%-- insert code here --%>

Which three EL expressions, inserted at line 16, are valid and evaluate to "d"? (Choose three.)

A. ${map.c} 
B. ${map[c]}
C. ${map["c"]}
D. ${map.map.b}
E. ${map[map.b]}
F. ${map.(map.b)}
  
Answer: A, C, E


Q: 157 Assume the tag handler for a st:simple tag extends SimpleTagSupport. In what way can scriptlet code be used in the body of st:simple? 

A.      set the body content type to JSP in the TLD

B.      Scriptlet code is NOT legal in the body of st:simple.
C.      add scripting-enabled="true" to the start tag for the st:simple element
D.      add a pass-through Classic tag with a body content type of JSP to the body of st:simple, and place the scriptlet code in the body of that tag

Answer: B

www.ExamWorx.com Q: 158 Which statement is true if the doStartTag method returns EVAL_BODY_BUFFERED ? 

A.      The tag handler must implement BodyTag.

B.      The doAfterBody method is NOT called.
C.      The setBodyContent method is called once.
D.      It is never legal to return EVAL_BODY_BUFFERED from doStartTag. 

Answer: C


Q: 159 You are creating a library of custom tags that mimic the HTML form tags. When the user submits a form that fails validation, the JSP form is forwarded back to the user. The <t:textField> tag must support the ability to re-populate the form field with the request parameters from the user's last request. For example, if the user entered "Samantha" in the text field called firstName, then the form is re-populated like this:

<input type='text' name='firstName' value='Samantha' />

Which tag handler method will accomplish this goal?

A. public int doStartTag() throws JspException { JspContext ctx = getJspContext();
String value = ctx.getParameter(this.name); if ( value == null ) value = "";
JspWriter out = pageContext.getOut(); try {
out.write(String.format(INPUT, this.name, value)); } (Exception e) { throw new JspException(e); } return SKIP_BODY;
}
private static String INPUT
= "<input type='text' name='%s' value='%s' />"; B. public void doTag() throws JspException { JspContext ctx = getJspContext();
String value = ctx.getParameter(this.name); if ( value == null ) value = "";
JspWriter out = pageContext.getOut(); try {
out.write(String.format(INPUT, this.name, value)); } (Exception e) { throw new JspException(e); }
}
private static String INPUT = "<input type='text' name='%s' value='%s' />";
C. public int doStartTag() throws JspException { ServletRequet request = pageContext.getRequest(); String value = request.getParameter(this.name);
if ( value == null ) value = ""; JspWriter out = pageContext.getOut(); try {
out.write(String.format(INPUT, this.name, value)); } (Exception e) { throw new JspException(e); } return SKIP_BODY;
}
private static String INPUT = "<input type='text' name='%s' value='%s' />";
D. public void doTag() throws JspException { ServletRequet request = pageContext.getRequest(); String value = request.getParameter(this.name);
if ( value == null ) value = ""; JspWriter out = pageContext.getOut(); try {
out.write(String.format(INPUT, this.name, value)); } (Exception e) { throw new JspException(e); }
}
private static String INPUT = "<input type='text' name='%s' value='%s' />";

Answer: C


Q: 160 Which two directives are applicable only to tag files? (Choose two.)

A. tag
B. page
C. taglib
D. include
E. variable

Answer: A, E


Q: 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


Q: 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


Q: 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


Q: 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


Q: 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


Q: 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


Q: 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


Q: 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


Q: 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


Q: 170 Which security mechanism uses the concept of a realm?

A. authorization
B. data integrity
C. confidentiality
D. authentication 

Answer: D


Q: 171 Which two security mechanisms can be directed through a sub-element of the <user-data-constraint> element in a web application deployment descriptor? (Choose two.)

A. authorization
B. data integrity
C. confidentiality
D. authentication 

Answer: B, C


Q: 172 You are developing several tag libraries that will be sold for development of third-party web applications. You are about to publish the first three libraries as JAR files: container-tags.jar, advanced-html-form-tags.jar, and basic-html-form-tags.jar. Which two techniques are appropriate for packaging the TLD files for these tag libraries? (Choose two.)

A. The TLD must be located within the WEB-INF directory of the JAR file.
B. The TLD must be located within the META-INF directory of the JAR file.
C. The TLD must be located within the META-INF/tld/ directory of the JAR file.
D. The TLD must be located within a subdirectory of WEB-INF directory of the JAR file.
E. The TLD must be located within a subdirectory of META-INF directory of the JAR file.
F. The TLD must be located within a subdirectory of META-INF/tld/ directory of the JAR file. 

Answer: B, E


Q: 173 A custom tag is defined to take three attributes. Which two correctly invoke the tag within a JSP page? (Choose two.)

A. <prefix:myTag a="foo" b="bar" c="baz" />
B. <prefix:myTag attributes={"foo","bar","baz"} />
C. <prefix:myTag jsp:attribute a="foo" b="bar" c="baz" />
D. <prefix:myTag> <jsp:attribute a:foo b:bar c:baz /> </prefix:myTag>
E. <prefix:myTag> <jsp:attribute ${"foo", "bar", "baz"} /> </prefix:myTag>
F. <prefix:myTag> <jsp:attribute a="foo" b="bar" c="baz"/> </prefix:myTag>
G. <prefix:myTag> <jsp:attribute name="a">foo</jsp:attribute>
<jsp:attribute name="b">bar</jsp:attribute> <jsp:attribute name="c">baz</jsp:attribute> </prefix:myTag> 

Answer: A, G


Q: 174 In a JSP-centric shopping cart application, you need to move a client's home address of the Customer object into the shipping address of the Order object. The address data is stored in a value object class called Address with properties for: street address, city, province, country, and postal code. Which two JSP code snippets can be used to accomplish this goal? (Choose two.)

A. <c:set var='order' property='shipAddress' value='${client.homeAddress}' />
B. <c:set target='${order}' property='shipAddress' value='${client.homeAddress}' />
C. <jsp:setProperty name='${order}' property='shipAddress' value='${client.homeAddress}' />
D. <c:set var='order' property='shipAddress'> <jsp:getProperty name='client' property='homeAddress' /> </c:store>
E. <c:set target='${order}' property='shipAddress'> <jsp:getProperty name='client' property='homeAddress' /> </c:set>
F. <c:setProperty name='${order}' property='shipAddress'> <jsp:getProperty name='client' property='homeAddress' /> </c:setProperty>

Answer: B, E


Q: 175 You have been contracted to create a web site for a free dating service. One feature is the ability for one client to send a message to another client, which is displayed in the latter client's private page. Your contract explicitly states that security is a high priority. Therefore, you need to prevent cross-site hacking in which one user inserts JavaScript code that is then rendered and invoked when another user views that content. Which two JSTL code snippets will prevent cross-site hacking in the scenario above? (Choose two.)

20. <c:out>${message}</c:out>
21. <c:out value='${message}' />
22. <c:out value='${message}' escapeXml='true' />
23. <c:out eliminateXml='true'>${message}</c:out>
24. <c:out value='${message}' eliminateXml='true' />
Answer: B, C


Q: 176 Click the Exhibit button.

Assuming the tag library in the exhibit is imported with the prefix forum, which custom tag invocation produces a translation error in a JSP page?


A. <forum:message from="My Name" subject="My Subject" />
B. <forum:message subject="My Subject"> My message body.</forum:message>
C. <forum:message from="My Name" subject="${param.subject}"> ${param.body}
</forum:message>
D. <forum:message from="My Name" subject="My Subject"> <%= request.getParameter( "body" ) %> </forum:message>
E. <forum:message from="My Name" subject="<%= request.getParameter( "subject" ) %>"> My message body. </forum:message> 

Answer: D


Q: 177 Which JSTL code snippet can be used to import content from another web resource?

A. <c:import url="foo.jsp"/>
B. <c:import page="foo.jsp"/>
C. <c:include url="foo.jsp"/>
D. <c:include page="foo.jsp"/>
E. Importing cannot be done in JSTL. A standard action must be used instead. 

Answer: A


Q: 178 Click the Exhibit button.

Assume the tag library in the exhibit is placed in a web application in the path /WEB-INF/tld/example.tld.

1.

2. <ex:hello />

Which JSP code, inserted at line 1, completes the JSP code to invoke the hello tag?


A. <%@ taglib prefix="ex" uri="/WEB-INF/tld" %>
B. <%@ taglib uri="/WEB-INF/tld/example.tld" %>
C. <%@ taglib prefix="ex" uri="http://localhost:8080/tld/example.tld" %>
D. <%@ taglib prefix="ex" uri="http://example.com/tld/example" %> 

Answer: D


Q: 179 Which JSTL code snippet produces the output "big number" when X is greater than 42, but outputs "small number" in all other cases?

A. <c:if test='<%= (X > 42) %>'> <c:then>big number</c:then> <c:else>small number</c:else> </c:if>
B. <c:if> <c:then test='<%= (X > 42) %>'>big number</c:then><c:else>small number</c:else> </c:if>
C. <c:choose test='<%= (X > 42) %>'> <c:then>big number</c:when> <c:else>small number</c:otherwise> </c:choose>
D. <c:choose test='<%= (X > 42) %>'> <c:when>big number</c:when> <c:otherwise>small number</c:otherwise> </c:choose>
E. <c:choose> <c:when test='<%= (X > 42) %>'>big number</c:when> <c:otherwise>small number</c:otherwise> </c:choose>

Answer: E

Q: 180 A developer chooses to avoid using SingleThreadModel but wants to ensure that data is updated in a thread-safe manner. Which two can support this design goal? (Choose two.)

A. Store the data in a local variable.
B. Store the data in an instance variable.
C. Store the data in the HttpSession object.
D. Store the data in the ServletContext object.
E. Store the data in the ServletRequest object.

Answer: A, E