Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Error loading file

 
Svend Rost
Ranch Hand
Posts: 904
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I'd like to load a file from my Servlet and read it's contens, but
I get an "Error loading file" when the code is run.

Where should I place the file ?

My servlet class file lies in: Tomcat/webapps/examples/WEB-INF/classes/
where the file also lies. I contact the Servlet via the following URL:
http://localhost:8080/examples/servlet/<servletname>

Thanks in advance,

/Svend Rost
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Look up ServletContext.getResource or ServletContext.getResourceAsStream.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13074
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your use of /servlet/ in the URL indicates you may be getting tangled up in the "invoker" servlet conventions. Read this FAQ on the invoker here at the ranch.
Bill
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic