Quoting Patrick Scheuerer <[EMAIL PROTECTED]>:

> Matthias Wessendorf wrote:
> 
> > Hi Patrick,
> > 
> > you want to get the path of /myapp 
> > like C:\Tomcat\webapps\myapp
> > or?
> 
> That's exactly what i was trying to do!
> 
> > in an actionClass
> > you now want to store
> > in placeString\uploaddir
> > isn�t it?
> 
> Right again :-)
> 
> > i wrote an Util-Class which managed the
> > storage in my action.
> > one parameter is the formfile the other the placeToStore.
> > you can get it, if you want...
> 
> That would be wonderful! Thank you very much for your help!
> 

I would also offer a couple of cautions about this approach:

* You are not guaranteed that a particular servlet container
  even *has* a concept of a directory in which the web app
  is deployed -- for example, even Tomcat can execute a webapp
  directly from the WAR file.  When you do that, getRealPath()
  returns null instead of a pathname, and your calculations above
  will trigger a NullPointerException.

* Even when you know that your apps are being deployed in unpacked
  directories, uploading things directly into that directory means
  you have to be careful about redeployment when you update the app
  -- the normal behavior of "delete the old directory and replace it
  with the new app" wipes out any uploaded files.

I would recommend defining a directory somewhere in your server to hold the
uploaded files for a webapp, and then pass the pathname of this directory to
your app as a context init parameter or something like that.  This approach
deals with both of the problems identified above.

> Patrick
> 

Craig


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to