Home » Java » struts2 in s:select list –>The requested list key '' as a collection/array/map/enumeration/iterator type

struts2 in s:select list –>The requested list key '' as a collection/array/map/enumeration/iterator type

Posted by: admin October 26, 2017 Leave a comment

Questions:

I have below struts2 code that when open url, it has exception in the field:
tag ‘select’, field ‘list’, name ‘loanForm.dobDay’: The requested list key ‘loanForm.getDayRange()’ could not be resolved as a collection/array/map/enumeration/iterator type. Example: people or people.{name}

<s:select id="dobDay" name="loanForm.dobDay" value="%{loanForm.dobDay}"
                     list="loanForm.getDayRange()"
                        style="width:40px">
                    </s:select>

public List<String> getDayRange() {
        List<String> day = new ArrayList<String>();
        day.add("");
        for (int i=1; i<=31; i++) {
            day.add(String.valueOf(i));
        }

        return day;
    }

One more discovered:

Messages: tag ‘select’, field ‘list’, name ‘loanForm.confirmationOfficeNt’: The requested list key ‘#session.sBranchCatN’ could not be resolved as a collection/array/map/enumeration/iterator type. Example: people or people.{name}

Answers: