JSF: how to get all managed beans from faces-config.xml

Hi,

I am a JSF newbie and I face the following problem:

Is there a method that returns me (possibly) a list or other datastructure of all managed beans I have in my facesconfig.xml?

I am trying with getApplication()

but it doesn't help.

What I want to do is to read out managed beans from faces-config and iterate over them (and the properties set in faces-config.xml) in code.

Thanks!

[430 byte] By [pi6502a] at [2007-11-26 21:44:31]
# 1
Use DOM4J or JXPath to read the faces-config.xml.But why do you want to do this anyway? Maybe there are better solutions.
BalusCa at 2007-7-10 3:32:23 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2
FacesContext.getCurrentInstance().getExternalContext().getSessionMap()returns a session map with the managed beans declared in session:)
pi6502a at 2007-7-10 3:32:23 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3
The sessionmap (and requestmap and applicationmap) don't strictly contain managed beans only ..I still don't know what you want to do with this information.Maybe this article will give some new insights: http://balusc.xs4all.nl/srv/dev-jep-com.html
BalusCa at 2007-7-10 3:32:23 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4

No, but if I've declared Configuration Beans in the session scope, I get them (beside other things). However, I have some other problem now:

Starting from an outcome, my code resolves which class to instantiate by looking at the faces-config.xml (see the above method I have used). However, I want *all* Configuration Beans (hence classes) to be instantiated, not just the one of that session... (the session would be the one related the outcome I have started from).

I am programming with an open source framework (FROG see http://dev.cocos.bz/projects/frog), which is heavily modified to use SOA approach (Business components that expose services). One BC = one Configuration Bean = one class.

Cheers!

pi6502a at 2007-7-10 3:32:23 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 5

You may have a look at Spring for this and move all your backing beans in the Spring context to manage them how you need it.

Here's the concept:

http://blog.rainer.eschen.name/2006/11/16/the-observer-pattern-in-mixed-dependency-injection-contexts-spring-jsf/

The deployment configuration can be found in the Spring reference or you use Spring-JSF (see article above).

rainwebsa at 2007-7-10 3:32:23 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...