• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

context-param

 
Ranch Hand
Posts: 383
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Which of the following are true regarding the parameters defined using the <context-param> element of a deployment descriptor?

Options

Select 2 correct options.


They are thread safe.-answer


They are accessible from multiple threads simultaneously and from any servlet of the web application.-answer


They can be modified using the setAttribute() method.


They can be modified using the setParameter() method.


They can be modified using the setInitParameter() method.


Detailed Explanation

<context-param> element is used to define the initialization parameters for the web application as a whole. They are read only and are thus thread safe. You cannot add or modify the parameters using any of the set methods.

--------------------------------
-This example is from jdiscuss.com. I have posted example & also answers & explaination. But I don't understand why you cannot add or modify the parameters using any of the set methods. I saw the ServletContext interface has a setAttribute(). Can anyone clear my doubt?
 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
context parameter and attribute are two different things
The former stores just the name/value String pairs whereas the latter stores name and Object pairs
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic