If an example of a ContextListener would be helpful, and perhaps even something that will do the trick for you, depending on the requirements, take a look at the code I just checked in to CVS for JavaWebParts:

http://sourceforge.net/projects/javawebparts/

It is available in HEAD. I added a ContextListener that reads in an XML file and exposes it in a bean (either a default simple bean or your own custom job). If by chance the data you need can be stored in an XML file and not tied to a session, this might do the trick for you. And even if it isn't appropriate, it should at least be a working example of a listener for you.

Actually, an interesting thought... if you took my listener and made your XML file just name the table to query, you could still read from a database... create a custom bean with a setter that matches the element in the XML file, and instead of just setting a class field, do the database read and whatever else. Not how I envisioned it being used, but I think it should work.

Frank

Aleksandar Matijaca wrote:
Wendy, can you please give me the complete class name of that Listener object? Is it referenced in the web.xml??

Thanks, Alex.



On 6/21/05, Wendy Smoak <[EMAIL PROTECTED]> wrote:

From: "Rafael Taboada" <[EMAIL PROTECTED]>

I need to store some objects in session scope in order to use
around the application.

If you need to use them across the entire webapp, then application/context
scope might be more appropriate. But either way, what I do is have a
Listener that is notified when the app (or a session) starts. I put various Maps and Lists into the appropriate scope under known keys, and then they're
there to be used whenever I need them.

Take a look at HttpSessionListener or ServletContextListener depending on
what you decide you need.

--
Wendy Smoak


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





--
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to