RE: Application scope beans

2002-03-25 Thread Juan Alvarado \(Struts List\)

John:

The following snipet of code should handle what you need:

Object someObject =
(Object)servlet.getServletContext().getAttribute("nameOfObjectHandleInApplic
ation");

The reference to Object above would of course be replaced with the class
name of the object you are trying to access.
Also, the code above assumes you are calling the servlet from within an
Action.

Please let me know if this works for you.

**
Juan Alvarado
Internet Developer -- Manduca Management
(786)552-0504
[EMAIL PROTECTED]
AOL Instant Messenger: [EMAIL PROTECTED]

-Original Message-
From: John Jones [mailto:[EMAIL PROTECTED]]
Sent: Saturday, March 23, 2002 11:00 AM
To: Struts Users Mailing List
Subject: Application scope beans


Does anyone out there know how to access objects in application scope from a
servlet? We want to have a startup servlet that puts a bunch of beans in
application scope on application server startup.


--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




RE: Application scope beans

2002-03-23 Thread Etienne, Ingo (Goetzfried AG)

Try this in a Action instance:

javax.servlet.ServletContext ctx =
this.getServlet().getServletContext();
Object obj = ctx.getAttribute("key");
ctx.setAttribute("key", obj);


-Original Message-
From: John Jones [mailto:[EMAIL PROTECTED]]
Sent: Samstag, 23. März 2002 17:00
To: Struts Users Mailing List
Subject: Application scope beans


Does anyone out there know how to access objects in application scope from a
servlet? We want to have a startup servlet that puts a bunch of beans in
application scope on application server startup.

--
To unsubscribe, e-mail:   
For additional commands, e-mail: