With the help of web.xml in web-inf directory is it possible to specify a default file read write delete location independent of using Tomcat or Serveltexec or Jrun. I need this for servlet/jsp to write/read xml,xsl files. Regards Balaji
Hi, If i write a file in servlet using Tomcat its creating the file at tomcat\bin directory. Using ServletExec its creating the file at c:\winnt\system32 directory
Is it possible to make it at single location using either web.xml or servlet init parameters.
Am I in the blacklist or something,why no one is replying to me ?? I don't think it's personal. I think a lot of people just didn't understand your question, and hoped someone else would answer it. Your second explanation seems clearer, so I'll have a stab at it. If i write a file in servlet using Tomcat its creating the file at tomcat\bin directory. Using ServletExec its creating the file at c:\winnt\system32 directory. Is it possible to make it at single location using either web.xml or servlet init parameters. There is no requirement in the servlet specification for a container to set the "current directory" for file access to anything in particular. However, there are two ways round this. If all you need is somewhere to put "temporary files", the the container must provide some sort of writable temporary directory, and put a File object for it in the "javax.servlet.context.tempdir" context attribute. If you need something more permanent, you will need to configure it using some sort of init parameter. In your web.xml file you could put something like:
The you can create a "workdir" File object to represent this directory using comething like:
Yes Frank it helped and worked for me! Now i have decided to use request.getContextPath() than hardcoding at c:\data. Sorry i was so upset trying this,thats why i wrote like that,also i'm switching from Tomcat to Serveltexec,got lost on many things. Now I'm okay. Thanks again. Regards Balaji
Post by:autobot
It was the best of times. It was the worst of times. It was a tiny ad.
a bit of art, as a gift, that will fit in a stocking