Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Practice exam question

 
john marc almazan
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi guys, please help me answer this question.

web.xml:

<servlet>
<servlet-name>MyServlet</servlet-name>
<servlet-class>com.MyServlet</servlet-class>
<security-role-ref>
<role-name>manager</role-name>
<role-link>supervisor</role-link>
</security-role-ref>
</servlet>

//assume there is role name define for supervisor

Which of the following statements are correct?

A. The servlet code should use "manager" as a parameter in
request.isUserInRole() method.

B. The servlet code can use "manager" or "supervisor" as a
parameter in request.isUserInRole() method.

My answer is letter B because even though you have manager(a fake name) which map to supervisor(original name), there is no conflict between the two names so you can still use both names.

what do you think guys?
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!