How to use Managed Bean reference inside faces-config.xml?

Managed Bean in JSF can refer another managed bean inside the faces-config.xml. There is no restriction for the type of bean can be refered. But, JSF does not support the cyclic dependencies for Managed Bean reference.

also read:

For example, you cannot refer bean B from bean A while bean B also refers to bean A. The following simple program demonstrates how to refer a listBean inside a normal JSF Managed Bean. For simplicity purpose this example use List as managed bean. You can use any type of bean for the reference.

JSP File (index.jsp)

<%@taglib prefix="f" uri=""%>
<%@taglib prefix="h" uri=""%>
                <h:dataTable var="loc" value="#{jsfBean.listValues}">
                        <h:outputText value="#{loc}" />

JavaBean (


import java.util.List;

 * source :
public class JavaBeatJsfBean {
    private List listValues;

    public List getListValues() {
        return listValues;

    public void setListValues(List listValues) {
        this.listValues = listValues;


<?xml version='1.0' encoding='UTF-8'?>
<faces-config version="1.2"
            <value>Steve Jobs</value>
            <value>Sergy Brin</value>
            <value>Larry Page</value>
            <value>Anil Ambani</value>

Leave a Reply

Your email address will not be published. Required fields are marked *

Pin It on Pinterest

Share This

Share this post with your friends!