I have to display customer details in visualforce component. I am able to fetch values from wrapper class to vf component controller but not able to display values in VF component using apex:repeat. I am using Map to display values in component as one customer may be having 1 or more records so I need to display customer Id as heading and under this heading I need to display this customer record(s) then 2nd customer and so on....

VF Component

<apex:component controller="CustSrchController">
    <apex:attribute name="custExtId" type="String" description="passing customer external Id" assignTo="{!CustomerExtId}"/>
    <apex:pageBlock title="Customer Details 4...">
        <apex:repeat value="{!PackageMap1}" var="cust2">
        <apex:outputText value="{!PackageMap1[cust2]}" />
            <apex:pageBlockSection columns="3">
                <apex:facet name="header"> Customer Id {!PackageMap1[cust2].custId}</apex:facet>
                <apex:pageBlockSectionItem >
                    <apex:outputLabel value="Card Number" for="custCC" />
                    <apex:outputText value="{!PackageMap1[cust2].custCC}" id="custCC" />
                <apex:pageBlockSectionItem >
                    <apex:outputLabel value="Account Id" for="custAccID" />
                    <apex:outputText value="{!PackageMap1[cust2].custAccID}" id="custAccID" />

VF Component Controller

public class CustSrchController {

public String CustomerExtId;

public void setCustomerExtId (String s) {
    CustomerExtId = s.toUpperCase();
public String getCustomerExtId() {
    return CustomerExtId;

public list<WrapperResponses.Customers> lstCustomer{get;set;}
public List<WrapperResponses.Customers> lstCustExtDetailsSearch{get;private set;}

List<String> custList = new List<String>();
public Map<string,WrapperResponses.Customers> custMap = new Map <string,WrapperResponses.Customers>();
public Map<string,List<String>> custMap1 = new Map <string,List<String>>();

    public void CustomerDetails(){
    //public void getCustomerDetails(){

        WrapperResponses.CustInquiryResp cust = APIController.getCustomerInquiry('ABC',CustomerExtId,'PQR');
        lstCustomer = cust.customers;

        WrapperResponses.CustSearchResp custSearch = APIController.searchCustomers('LNAME','FNAME','M','1234','1234567890','A1','123456','abc@gmail.com');        
        lstCustExtDetailsSearch = custSearch.customers;

        for (WrapperResponses.Customers custItem : lstCustomer) {
            custMap.put(custItem.customerExternalIdentifier, custItem);
            //custMap.put(custItem.customerExternalIdentifier, custList);
            custMap1.put(custItem.customerExternalIdentifier, custList);
    public Map<string,WrapperResponses.Customers> getPackageMap() {
        return custMap;
    public Map<string,List<String>> getPackageMap1() {
        return custMap1;

Wrapper Class

public with sharing class WrapperResponses {
    public WrapperResponses() {

    //API Response for Customer Inquiry API
    public class CustInquiryResp{
        public List<Customers> customers;

    // API Response for Customer Search API
    public class CustSearchResp{
        public List<Customers> customers;

    //Dummy API to get Customer Response
    public class Customers {
        //these are from inquiry api
        public String customerId{get;}
        public String customerCC{get;}
        public String customerAccId{get;}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.