How to initialize Map property in Managed Mean?

Map property in Managed Mean

JSF Managed Beans can initialize its Map properties in the faces-config.xml. There is a property in the faces-config.xml as map-entries. This can be used for initializing the values and can be accessed directly through the Managed Beans in any JSP pages.

also read:

You also can directly use the List as Managed Beans.

JSP File (index.jsp)

<%@taglib prefix="f" uri=""%>
<%@taglib prefix="h" uri=""%>
                 <h:outputText value="#{jsfBean.mapValues['1']}"/>
                 <h:outputText value="#{jsfBean.mapValues['2']}"/>
                 <h:outputText value="#{jsfBean.mapValues['3']}"/>

JavaBean (


import java.util.Map;

 * source :
public class JavaBeatJsfBean {

    private Map mapValues;

    public Map getMapValues() {
        return mapValues;

    public void setMapValues(Map mapValues) {
        this.mapValues = mapValues;



<?xml version='1.0' encoding='UTF-8'?>
<faces-config version="1.2"

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!