Ensurepass.com : Ensure you pass the IT Exams
2018 Jan Oracle Official New Released 1z0-899
100% Free Download! 100% Pass Guaranteed!
http://www.EnsurePass.com/1z0-899.html
Java EE 6 Web Component Developer Certified Expert Exam
Question No: 51
Given:
1. lt;% int[] nums = {42,420,4200};
2. request.setAttribute(quot;fooquot;, nums); %gt; 3. ${5 3 It 6}
-
S(requestScope[#39;foo#39;][0] ne 10 div0gt; 5. ${10 div 0}
What is the result?
-
true true
-
false true
-
false true 0
-
true true Infinity
-
false true Infinity
-
An exception is thrown
-
Compilation or translation fails
-
Answer: E
Question No: 52
Which EL expression returns true if no session has been established with current client?
-
${not(pageContext.session)}
-
${not(requestScope.session)}
-
${requestScope.sessions.this}
-
${sessionScope.empty}
Answer: A
Explanation:
Note:
-
A session is never null. The session is always present in JSP EL, unless you add
lt;%@page session=quot;falsequot; %gt;
-
If you#39;d like to check if the session is new or has already been created, use HttpSession#isNew() instead.
lt;c:if test=quot;${not pageContext.session[#39;new#39;]}quot;gt;
lt;pgt;You#39;ve already visited this site before.lt;/pgt;
lt;/c:ifgt;
lt;c:if test=quot;${pageContext.session[#39;new#39;]}quot;gt;
lt;pgt;You#39;ve just started the session with this request!lt;/pgt;
lt;/c:ifgt;
Question No: 53
APIs for dynamically registering servlets and filters can be called at:
-
Context initialization time
-
Any time
-
There is no way to dynamically register servlets and filters
-
Context destruction time
-
Injected into a servlet context
Answer: A
Question No: 54
Which java code snippet checks whether the user is of the role “MANAGER” for a given HttpServRequest, httpServletRequest?
-
httpServletRequest.isUserInRole(“MANAGER”);
-
httpServletRequest.isCallerInRole(“MANAGER”);
-
httpServletRequest.isPrincipalInRole(“MANAGER”);
-
httpServletRequest.isAuthnticatedUserInRole(“MANAGER”);
Answer: A
Explanation: isUserInRole
public boolean isUserInRole(java.lang.String role)
Returns a boolean indicating whether the authenticated user is included in the specified logical quot;rolequot;. Roles and role membership can be defined using deployment descriptors. If the user has not been authenticated, the method returns false.
Parameters:
role – a String specifying the name of the role Returns:
a boolean indicating whether the user making this request belongs to a given role; false if the user has not been authenticated
Incorrect:
Not B: isCallerInRole is depreciated.
Question No: 55
ServletRegistration.Dynamic can be used to configure (Choose two)
-
Filter mappings
-
add init params
-
set asyncSupported to true
-
add Listeners
Answer: A,B
Reference: http://www.softwareengineeringsolutions.com/blogs/2010/08/01/ (3rd paragraph)
Question No: 56
Which of the following annotations relate to security in a servlet?
-
@WebSecurity
-
@RolesAllowed
-
@WebConstraint
-
@HttpConstraint
-
@Servletsecurity
-
(i) only
-
(i) and (iii)
-
(iv) and (v)
-
(iii) and (v)
-
(ii) and (iv)
Answer: C
Question No: 57
Refer to the Exhibit.
Assuming the tag library in the exhibit is imported with the prefix forum, which custom tag invocation procedures a transaction error in a jsp page?
-
lt;forum:message from=quot;My Namequot; subject=quot;My Subjectquot; /gt;
-
lt;forum:message subject=quot;My Subjectquot;gt; My message body.
lt;/forum:messagegt;
-
lt;forum:message from=quot;My Namequot; subject=quot;${param.subject}quot;gt;
${param.body}
lt;/forum:messagegt;
-
lt;forum:message from=quot;My Namequot; subject=quot;My Subjectquot;gt;
lt;%= request.getParameter( quot;bodyquot; ) %gt;
lt;/forum:messagegt;
-
lt;forum:message from=quot;My Namequot;
subject=quot;lt;%= request.getParameter( quot;subjectquot; ) %gt;quot;gt; My message body.
lt;/forum:messagegt;
Answer: D Explanation: New Questions
Question No: 58
Given the element from the web application deployment descriptor:
lt;jsp – property – groupgt;
lt;url – patterngt;/main/page1.jsplt;/url – patterngt;
lt;scripting – invalidgt;truelt;/scripting – invalidgt;
lt;/jsp-property-groupgt;
And given that /main/page1.jsp contains:
lt;% int i = 12; %gt;
lt;bgt; lt;%= i %gt; lt;/bgt; What is the result?
A. lt;bgt; lt;bgt;
B. lt;bgt; l2 lt;/bgt;
C. The JSP fails to execute.
D. lt;% int i = 12 %gt;
lt;bgt; lt;%= i % gt; lt; bgt;
Answer: C
Question No: 59
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 lt;context-paramgt; 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?
-
You cannot do this because context parameters CANNOT be altered programmatically.
-
String ext = context.getParameter(‘licenseExtension’);if ( ext == null ) { context.setParameter(‘licenseExtension’ DEFAULT);}
-
String ext = context.getAttribute(‘licenseExtension’);if ( ext == null ) { context.setAttribute(‘licenseExtension’ DEFAULT);}
-
String ext = context.getInitParameter(‘licenseExtension’)if ( ext == null ) { context.resetInitParameter(‘licenseExtension’ DEFAULT);}
-
String ext = context.getInitParameter(‘licenseExtension’)if ( ext == null ) { context.setInitParameter(‘licenseExtension’ DEFAULT);}
Answer: A
Question No: 60
Which of following annotations can be used in a servlet class?
->@javax.annotation.Resource
->@javax.annotation.PreDestroy
->@javax.annotation.security.RunAs
->@javax.annotation.security.RolesAllowed
->@javax.servlet.annotation.WebServlet
-
(v) only
-
(i) and (v)
-
(i), (ii), (iii) and (v)
-
(i), (ii), (iv) and (v)
-
(i), (ii), (iii), (iv) and (v)
Answer: B
Explanation: * (i) The javax.annotation.Resource annotation is used to declare a reference to a resource. @Resource can decorate a class, a field, or a method.
-
-
(v) javax.servlet.annotation Annotation Type WebServlet
Annotation used to declare a servlet.
This annotation is processed by the container at deployment time, and the corresponding servlet made available at the specified URL patterns.
Incorrect:
-
Not (II) : javax.annotation.PreDestroy Target: Method
100% Ensurepass Free Download!
–Download Free Demo:1z0-899 Demo PDF
100% Ensurepass Free Guaranteed!
–1z0-899 DumpsEnsurePass ExamCollection Testking Lowest Price Guarantee Yes No No Up-to-Dated Yes No No Real Questions Yes No No Explanation Yes No No PDF VCE Yes No No Free VCE Simulator Yes No No Instant Download Yes No No HOT CATEGORY!HOT EXAM!100-105 Dumps VCE PDF
200-105 Dumps VCE PDF
300-101 Dumps VCE PDF
300-115 Dumps VCE PDF
300-135 Dumps VCE PDF
300-320 Dumps VCE PDF
400-101 Dumps VCE PDF
640-911 Dumps VCE PDF
640-916 Dumps VCE PDF
70-410 Dumps VCE PDF
70-411 Dumps VCE PDF
70-412 Dumps VCE PDF
70-413 Dumps VCE PDF
70-414 Dumps VCE PDF
70-417 Dumps VCE PDF
70-461 Dumps VCE PDF
70-462 Dumps VCE PDF
70-463 Dumps VCE PDF
70-464 Dumps VCE PDF
70-465 Dumps VCE PDF
70-480 Dumps VCE PDF
70-483 Dumps VCE PDF
70-486 Dumps VCE PDF
70-487 Dumps VCE PDF
220-901 Dumps VCE PDF
220-902 Dumps VCE PDF
N10-006 Dumps VCE PDF
SY0-401 Dumps VCE PDF