<p>I read a properties-file at the webapplication startup phase (contextInitialized()) and I started to think about how to make these settings 'visible' to the servlets. Do I need to loop through the keys and add each and every one to the context, like this</p>

<pre><code>Iterator i = settings.keySet().iterator();
while (i.hasNext()) {
    key = (String) i.next();
    value = (String) settings.get(key);
    context.setAttribute(key, value);
}
</code></pre>

<p>or are there better methods?</p>

<p>Thank you!</p>

<p>/Adam</p>

Have you considered the possibility of defining the settings in web.xml?
Also, if that's not possible, use generics if possible:
```
```
String key = null;
Iterator<String> i = settings.keySet().iterator();
while (i.hasNext())
 context.setAttribute(key = i.next(), settings.get(key));
```
```