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 Servlets and the fly likes Problem in reading csv file 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 » Java » Servlets
Bookmark "Problem in reading csv file" Watch "Problem in reading csv file" New topic
Author

Problem in reading csv file

pramodh somashekara
Ranch Hand

Joined: Jan 30, 2006
Posts: 62
Hi,

I have servlet under the path "java source/com/sample/search/search1/MyServlet.java" file and my csv file in "Web Content/csv/mycsv.csv"

When I tried to read the csv file from my servlet by giving path as ".../Web Content/csv/mycsv.csv", I am getting file not found exception.

Can you explain how to give correct path from servlet to my csv file?
Scheepers de Bruin
Ranch Hand

Joined: Jul 19, 2005
Posts: 99
There is a ServletContext method that returns the absolute or real path given a relative path.

You can use myServlet.getServletContext() to get to the ServletContext

Check the API for the exact method.

Hope this is at least a pointer in the right direction.


We're doomed!!<br />Yay!!!<br />No that's bad Girr!!<br />Yay!!!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem in reading csv file
 
Similar Threads
How to refresh a JSF page after downloading a CSV file.(content-disposition)
Read PDF File Path From Servlet. PDF is right under WebContent
Problem with servlet streaming CSV files in WinXP SP2
Download CSV file from apllication server
using JFileChooser