• Post Reply Bookmark Topic Watch Topic
  • New Topic

Reading csv file from within servlet problem

 
Darren Wilkinson
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I have a web app (Servlet/JSP) and I intend using FlatPack to parse a csv file but I am having trouble simply reading the file in.

Directory Structure

Web Pages
|_META-INF
|_WEB-INF
|_data_feeds
|_Demo.csv

The code I am using is below and it throws the following exception:

SEVERE: Servlet.service() for servlet FeedParser threw exception
java.net.MalformedURLException: no protocol: /mobileseeker/data_feeds/Demo.csv
at java.net.URL.<init>(URL.java:567)
at java.net.URL.<init>(URL.java:464)
at java.net.URL.<init>(URL.java:413)
at org.digitalturtle.sandpit.FeedParser.processRequest(FeedParser.java:30)
at org.digitalturtle.sandpit.FeedParser.doGet(FeedParser.java:61)


My dodgy code:



Any help would be great. Thanks for reading.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Instead of:

Try using

context.getResourceAsStream
context.getResourceAsStream
 
Darren Wilkinson
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for your comment.

I was just about to post this as I think I worked it out.


[ May 08, 2008: Message edited by: Darren Wilkinson ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!