dcsimg
creating a JavaBean object in a servlet with a scope of application.
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Anonymous
Posted On:   Friday, May 26, 2006 04:35 AM

What is the code i need to write in a servlet

to initialize a bean with a scope of application?

i.e., i have to write the code equivalent to the jsp action



can anyone help?


Please use html tags to format code blocks.

Re: creating a JavaBean object in a servlet with a scope of application.

Posted By:   Byron_Tymvios  
Posted On:   Friday, May 26, 2006 04:51 AM


You need to use the ServletContext's setAttribute and getAttribute method's.


In your servlet:

this.getServletContext().setAttribute("myObject", object);
OR
this.getServletConfig().getServletContext().setAttribute("myObject", object);

Hope This Helps
Byron

About | Sitemap | Contact