how to make a bean application scoped so that it will persist as long as the web application is running???
and how can we access it in our controller??
thank you

Recommended Answers

@ManagedBean
@ApplicationScope
public class YourClass ...

In Servlet:  getServletContext().getAttribute("yourClass")

In JSF: #{yourClass.whatever}
Jump to Post

All 3 Replies

@ManagedBean
@ApplicationScope
public class YourClass ...

In Servlet:  getServletContext().getAttribute("yourClass")

In JSF: #{yourClass.whatever}

thank you for the reply..are all controllers in spring framework singleton too?? meaning we can access them like this??

I know little about Spring. In JEE 6/7 most of these frameworks are no longer needed. IMHO.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.