If you meant to change the value, you can't - they are read-only. In JavaEE 6, you may set new parameters before the context is initialized. There is less chance you will ever need use this method if you wisely design your application.
I am trying to implement a very basic login and logout system.
So, when a user first visits my template website, the contect login state (a boolean variable) is set to false forcing the user to login - after the user logs in i would like to change the context parameter bool value to something like true - I was not aware that this is in fact a very bad thing.
Can someone please suggest how this can be done or rather are there any better practices in doing this?
First: use container-managed security instead of rolling your own.
If for some reason, you cannot, then you are definitely heading in the wrong direction.
Think about it for a minute. A context parameter (in addition to be read-only) is shared by all resources in the web app. So do you really think it would be appropriate for storing information for a single user? What if there's a second user? A four hundred and fifty first user? A ten thousandth?
So, again put on your thinking cap: where would be the appropriate place to store information that's pertinent for only one user?
Both servlet context and servlet config will be set in deployment descriptor.Servlet Config is per servlet where as servlet context param value will be shared by total webapp.
So,if you want to chane param value,you need to update in DD and need to restart the server.In real time,it is applicable for storing database values.And we cant use context params per request.