File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
using getResourceAsStream() in Servlet
Joined: Apr 07, 2008
Oct 05, 2008 23:57:00
I want to read xml files stored in resources folder of my web application,
so I am using
's getResourcesAsStream() which return
but I am not getting the Stream of the xml file and getting a
please help to solve this.....!
NJOY..........!<br />Bhupesh<br />NaCon
Joined: Mar 22, 2005
Oct 06, 2008 00:01:00
Welcome to JavaRanch.
What are you passing in as the parameter? Where is the file located?
[ October 06, 2008: Message edited by: Ulf Dittmer ]
Jerwin Louise Uy
Joined: Oct 27, 2007
Oct 07, 2008 20:51:00
Based on the javadoc of ServletContext, the only way it will return null is if the resource does not exist in the path you supplied.
Please verify the the resource your are trying to load exists. If it does, then verify if you are passing the correct parameters.
The rules governing the path of the parameter in this function is referred to in the getResource function of the ServletContext. Please refer to the javadoc.
Usually, it should start with "/" and should be relative to the current context root where the ServletContext object is created by the container.
Uy Jerwin Louise Vergara
Junior Developer / Research and Development at Incuventure Partners Corporation
I agree. Here's the link:
subject: using getResourceAsStream() in Servlet
hi friends i am getting exception when i am using jasper reports
Escape Encoding for XML attribute
each time encryption gives different result......??
MQ Exception --- 2033 error
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015