views:

21

answers:

1

I have a JavaBean that reads and processes an XML file. The XML file lives in the WEB-INF/ folder in my application. A JSP file uses the JavaBean to pass it the XML file name using the setProperty method, and uses the context path to do so.

This works fine in my local development environment, but when deployed as a WAR on our test environment, the context path resolves as null.

What is the best way of getting around this so I can deploy my application in any environment without manually inputting paths into a configuration file?

Thanks in advance

+1  A: 

Put the file in WEB-INF/classes and open it using Thread.currentThread().getContextClassLoader().getResourceAsStream()

Anon
Thanks, this worked well!
Jamie