How can I access a servlet context from a bean?
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Bob_McLaren
Posted On:   Tuesday, July 23, 2002 11:29 AM

I am calling a bean from many different JSP pages.
Throughout the user's session, I would like the bean to read/write different information to the servlet context, so that it can be shared between users in different sessions.



How can I achieve this without having to pass the ServletContext or JSPPage objects for every call?



I tried persisting the ServletContext in the bean after the user logged in, but it seems that the ServletContext is not serializable.



I know the name of my webapp. Is there some way for me to get the context by name? getServletContext("/mywebapp") or something like that?

Re: How can I access a servlet context from a bean?

Posted By:   Roger_Hand  
Posted On:   Tuesday, July 23, 2002 04:30 PM

Couldn't you just put the Bean in Application scope? Then any values it holds would be accessible to users in different sessions.
About | Sitemap | Contact