Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Reading file

 
Monmohan Singh
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to read an XMl file that is placed somewhere in the web-root/WEB-INF/ folder in the deployed war on the server.
How can I read the file from here by dynamically getting the complete file path??
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13058
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Look at the api for the javax.servlet.ServletContext interface.
With a ServletContext there are several possibilities - getResourceAsStream is popular or you can getRealPath to get an absolute path String.
Bill
 
Monmohan Singh
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks a lot for the help
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic