• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

Reading csv file from within servlet problem  RSS feed

 
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.
 
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!