managed-bean

JSF 2 localization (managed bean)

I have a properties file for localization: foo=Bar title=Widget Application This is tied in as a resource-bundle in the faces-config: <resource-bundle> <base-name>com.example.messages.messages</base-name> <var>msgs</var> </resource-bundle> I can access this just fine in the facelets view using EL: <title>#{msgs.title}<...

JSF - How do I force an application-scoped bean to instantiate at application startup?

I can't seem to find a way to force an application-scoped managed bean to be instantiated/initialized when the web app is started. It seems that application-scoped beans get lazy-instantiated the first time the bean is accessed, not when the web app is started up. For my web app this happens when the first user opens a page in the web ap...

java.lang.NullPointerException, when i am inside the constructor of a managed bean invoking methods from other beans

When I am inside the constructor of a managed and trying to reach out to other methods from other beans, I got java.lang.NullPointerException. Is there some kind of specification that not allow managed bean to do that? @ManagedProperty(value="#{document}") private DisplayListController document; @EJB DocumentSBean sBean; public NewUse...

Problem initializing backing bean property in constructor

Hello, I have managed bean/backing bean and I inject there (with @EJB) session bean. Now in constructor I want to use it to initialize property in backing bean with value from database. But injected session bean is null. What are the other ways to initialize? As far as I know I can't use @PostConstruct because fetching data from databas...

How does JSF find beans annotated with @ManagedBean?

As far as I know, for using @Annotations (or [Attributes] in C#) you have to have a reference to the class metadata, so that you can ask if the class is annotated (attributed) or not. My question is how does JSF implementation find all classes annotated with @ManagedBean? Does it scan all of the classes in the class path? Or is there a ...

Pass request parameters through FacesContext

Hi! I moved from JSF 1.2 to JSF 2.0 and it seems I missed something during the switch. I have following scenario: There is a button on one page with actionListener set to one managed bean's method which adds an object to request by calling FacesContext.getCurrentInstance().getExternalContext().getRequestMap().put("foo", fooObject); Na...