The moose likes Servlets and the fly likes InitParameters Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "InitParameters" Watch "InitParameters" New topic


Amul Kanjer

Joined: Sep 27, 2001
Posts: 1
Is there a way to change the InitParameters of a servlet on the fly without reloading the servlet.
David O'Meara

Joined: Mar 06, 2001
Posts: 13459

There are two easy ways to do it, firstly you can mek them instance variable so they are shared by all threads then anyone can alter the details, but this becomes difficult to track and manage.
The way we sometimes do it is have all properties (initparams or other) managed in an external class for all situations. This can, for example, represent a dynamic properties class that checks for changes in the properties file and reloads them if required.
It is sorta covered in the JavaRanch Style Guide.
subject: InitParameters
Similar Threads
Accessing Servlet init Parameter by Expression language
getInitParameter method in ServletContext and ServletConfig
Passing data to and from a jsp page
Servlet's "configuration" parameters
Servlet Constructor