How can I give a bean application scope from a servlet like you can from JSP by doing <jsp:useBean id="bean" scope="application" /> ?

Byron Tymvios

In a servlet you would need to manually create your bean object and then use the ServletContext's setAttribute method to give it application scope:

package.MyBean myBean = new package.MyBean();

this.getServletContext().setAttribute("myBean", myBean);

0 Comments  (click to add your comment)
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact