[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?? ;-)


On Thu, 17 Aug 2000 16:30:58 +0530, "Ambar Roy" <ambarroy@xxxxxxxxx> wrote:
> now i have some questions too (for tomcat!):
> 1.how can i make servlets read an external file (i need to access files for
> things like templates, etc)
My observations above might help you. I also have had difficulty reading files using servlets.

> 2.how can i enable session management for my servlets using url rewriting??
> and change the name of the session variable!

I saw a question like the above at the tomcat faq-o-matic. I haven't used the HTTPSession class much till now.To tell you the truth I have just started servlets couple of weeks back.

Regards,
 Sandip