users@glassfish.java.net

Re: java.io.FileNotFoundException tried to access a xml file with jdom

From: <glassfish_at_javadesktop.org>
Date: Thu, 09 Aug 2007 16:10:33 PDT

You could declare and implement a ServletContextListener. In its contextInitialized() impl, you would instantiate your bean, pass the ServletContext from the event notification to it, and store the bean in the ServletContext (application scope) itself. In your JSP, you would reference this bean by adding a "scope" attribute with value "application", like this:

    <jsp:usebean scope="application" ...>

With this, your bean would have access to the ServletContext, and with this, to your webapp's resources.

Jan
[Message sent by forum member 'jluehe' (jluehe)]

http://forums.java.net/jive/thread.jspa?messageID=230351