Multiple choice technology web technology

Which of the following methods can be used to retrieve all the attributes names from ServletContext?

  1. getAttributeNames()

  2. getAllAttributes()

  3. It is not possible to retrieve all the attributes in one call.

  4. getAttributes()

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

ServletContext.getAttributeNames() returns an Enumeration of all attribute names stored in the servlet context. Options B and D (getAllAttributes, getAttributes) are not valid methods. Option C is incorrect - you CAN retrieve all attribute names in one call.