File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Tomcat and the fly likes How to give a path name in web.xml Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Reply Bookmark "How to give a path name in web.xml" Watch "How to give a path name in web.xml" New topic
Author

How to give a path name in web.xml

phoenix raising
Greenhorn

Joined: Jan 07, 2012
Posts: 3

Hi in my project for uploading a image i have given path in web.xml as this runs in my system.

But when i host the site i need to give the path name of the directory from the server How can i give the path name in web.xml. if anyone dont understand my question give reply.thanks in advance
saahil gupta
Ranch Hand

Joined: Dec 26, 2011
Posts: 56
Can you post your Code here.
phoenix raising
Greenhorn

Joined: Jan 07, 2012
Posts: 3



This code works in local system as i have given absolute path.
When i hosted the site in server i have given the path as /image/ and it is available im my root directory. But it is not working as it shows error the path is not found as i also tried with webapps/cloud1_1_1/image as it is shown in ftp . Can anyone rectify it. Thanks in advance.
Rob Spoor
Saloon Keeper

Joined: Oct 27, 2005
Posts: 18370

The right approach would be to specify a path relative to the web application, then use ServletContext.getRealPath to turn it into an absolute path.


SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 12513

I can provide some practical solutions, but not to "phoenix raising". We don't have many rules here, but this one is critical: http://www.javaranch.com/name.jsp


One of the most odious afflictions that Business has inflicted on the modern English language is "pro-active". Most of the time it's simply redundantly used in place of the simple old word "active". And a good deal of the rest of the time it means "You're not overworked enough yet, so go out and find more!"
 
IntelliJ Java IDE
 
subject: How to give a path name in web.xml
 
Threads others viewed
Getting the appname from the web.xml
how to initiate hashtable and linklist
How to get the achieve Version of deployed webservices
JDBC Parameters as Context Parameters?
Spring with Quartz
MyEclipse, The Clear Choice

cast iron skillet 49er

more from paul wheaton's glorious empire of web junk: cast iron skillet diatomaceous earth rocket mass heater sepp holzer raised garden beds raising chickens lawn care CFL flea control missoula heat permaculture