Doing it the way you describe will only work from a servlet. If that is
ok, stop reading and do it that way. :-)
A more general way would be to use a classloader instead. There are many
good articles on how to do this (google for 'classloader resource'), but
one simple way is this:
InputStream
Jiri Chaloupka wrote:
Hallo,
I thinkin how I can read the xml file from /WEB-INF directory.
I found something as
InputStream is = servletContext.getResourceAsStream("/WEB-INF/something.xml")
but how I can get servletContext?.
From inside an Action, you can call getServlet().getServletContext().
; From: Jiri Chaloupka [mailto:[EMAIL PROTECTED]
> Sent: Sunday, October 19, 2003 12:23 PM
> To: [EMAIL PROTECTED]
> Subject: reading the xml file
>
>
> Hallo,
> I thinkin how I can read the xml file from /WEB-INF directory.
>
> I found something as
> InputStream
Hallo,
I thinkin how I can read the xml file from /WEB-INF directory.
I found something as
InputStream is = servletContext.getResourceAsStream("/WEB-INF/something.xml")
but how I can get servletContext?. Or, is t good way to read data, as
datasource names, from xml file and store it as instance
4 matches
Mail list logo