This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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 | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Products » Tomcat
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
Ifteqar Ald
Ranch Hand

Joined: Dec 26, 2011
Posts: 73
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
Sheriff

Joined: Oct 27, 2005
Posts: 19651
    
  18

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 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15952
    
  19

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


Customer surveys are for companies who didn't pay proper attention to begin with.
 
Don't get me started about those stupid light bulbs.
 
subject: How to give a path name in web.xml
 
Similar Threads
Spring with Quartz
How to get the achieve Version of deployed webservices
Getting the appname from the web.xml
how to initiate hashtable and linklist
JDBC Parameters as Context Parameters?