File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSF and the fly likes Is needed faces-config? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "Is needed faces-config?" Watch "Is needed faces-config?" New topic

Is needed faces-config?

Alan Duke

Joined: Apr 12, 2011
Posts: 26
When using java 6 and JSF 2.0, it is true that we do not need faces-config.xml?
Guy deLyonesse
Ranch Hand

Joined: Apr 12, 2011
Posts: 200

I can't imagine why you wouldn't. faces-config.xml is all of your navigation, validation, listeners and bean management.
Alan Duke

Joined: Apr 12, 2011
Posts: 26
Ok, is really necessary.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17417

In JSF2, faces-config is no longer mandatory. You can do most configuration that was formerly done in faces-config.xml using Java code annotations, and in particular, that means managed bean and managed property definitions as well as navigation.

However, there are some things that cannot be done in Java code, such as installing the bridge between the JSF EL resolver and Spring Framework's EL resolver. So in cases like that, you'd still need a faces-config.xml to hold that definition.

Like most XML configuration files that support annotation-configurable resources, if a definition appears both in Java code as an annotation and in an XML config file, the XML config file definition takes precedence. This allows you to do "management by exception" where standard components have standard interfaces, but can be overridden when the need arises.

An IDE is no substitute for an Intelligent Developer.
I agree. Here's the link:
subject: Is needed faces-config?
It's not a secret anymore!