wood burning stoves*
The moose likes Servlets and the fly likes Init parameters Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Init parameters " Watch "Init parameters " New topic
Author

Init parameters

Karim zibari
Greenhorn

Joined: Aug 19, 2005
Posts: 6
Hi

Servlet and application context init parameters are read when the container first loads. They cannot be set during deployment. But this is not the behavior I get when I try to change the init parameters during deployment. I can actually change them and the changes show up when I retreive them from within my servlets.

Many thanks
Karim
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

If you could tell us where the magic setInitParameter is, we might tell you that you are right Are you using some third-party library, or a wrapper around ServletConfig ? This is not supposed to be part of the servlet spec.
[ January 31, 2006: Message edited by: Satou kurinosuke ]

[My Blog]
All roads lead to JavaRanch
Karim zibari
Greenhorn

Joined: Aug 19, 2005
Posts: 6
Hi

there is no magic setInitParameter! Maybe I didn't put my question right. What I mean is that I changed the init parameters in the DD file by hand. And the changes showd up the servlets at deployment time.

Many thanks
Karim
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

Sorry for the misunderstanding.
Of course, you can change them by hand, in web.xml, as long as the container has not read it, i.e before deployment.
Karim zibari
Greenhorn

Joined: Aug 19, 2005
Posts: 6
but that's my problem. After the web.xml is loaded by the container, I manually change the init parameter. then I check if the new values can be accessed by my servlet. And they are. This is my problem.

Karim
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

What server are you using ?

In Tomcat, there is an Automatic Application Deployment :
http://www.jajakarta.org/tomcat/tomcat5.0/ja/docs/tomcat-docs/config/host.html

I didn't know either that it could reload when web.xml was updated !
[ January 31, 2006: Message edited by: Satou kurinosuke ]
Karim zibari
Greenhorn

Joined: Aug 19, 2005
Posts: 6
i am using Tomcat 5.0.28.
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

So your local host (the default in Tomcat) probably has autoDeploy set to true.

They cannot be set during deployment.

This is true as far as the servlet spec is concerned.
The auto update feature is a container specific functionality.
[ January 31, 2006: Message edited by: Satou kurinosuke ]
 
 
subject: Init parameters
 
Similar Threads
Init Params doubt
Intilization parameter
HFSJ attributes and listeners question doubt
where are the request parameters declare
configuring the DD for each servlet???