[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]

Re: [Java] Common init params in app web.xml



> Whatever I am asking is equally applicable to any servlet engine
conforming to the servlet API2.2
> specs. Sometimes when you are trying to make a servlet a generic one you
expect to get parameters from the user and not
> hardcode them into the app. So you have two options - take the values from
a properties file or from the servlet init params.
>
> Unfortunately, while a servlet is running(now this might get Tomcat
specific) the current directory of the servlet is the *server-root* e.g.
/usr/local/tomcat. So if you try to read/write files, keep this in mind. To
find out what is the current directory of the servlet try the
getRuntime().exec() function and do tell me what your engine comes out with.
>
> Now somethings like databse name.username etc. are common over all
servlets. You would like to send all of them to the servlets as init-params.
What do you do? copy-paste it for each servlet in the web.xml??? Or am I
missing something BIG around here?? ;-)

i have found something at this link... it is called context parameters!! try
it out, it shud solve this problem!!
http://jakarta.apache.org/tomcat/jakarta-tomcat/src/doc/appdev/web.xml.txt

this is a sample web.xml file from the tomcat web page!!

Bye,
    /\ |\/| |3 /\ r