0

I have the following code to show a list to users to select an option, it correctly shows the list options but when an option is selected and the form is submitted, it runs into following error.

错误

 Caused by: tag 'select', field 'list', name 'developerID': The requested list key 
 'listOfdevelopers' could not be resolved as a collection/array/map/enumeration/iterator type. 
 Example: people or people.{name} - [unknown location]

JSP

 <s:form ...>
  <s:select name="developerID"
                      label="developerID"
                      list="listOfdevelopers"
                      value="%{development.developerID}"
                      />
 </s:form>

我的代码

....
private Map listOfdevelopers;
private Development development = new Development();

public Map getListOfdevelopers() {
    return listOfdevelopers;
}

public void setListOfdevelopers(Map listOfdevelopers) {
    this.listOfdevelopers = listOfdevelopers;
}

public Development getDevelopment() {
    return development;
}

public void setDevelopment(Development development) {
    this.development = development;
}

@Override
public Development getModel() {
    return this.development;
}
...    
4

2 回答 2

0
<s:select list="listOfdevelopers"
                        id="developerID"
                         name="developerID"
                             label="developerID"
                             headerKey=""
                              headerValue="Please choose one."
                            value="%{development.developerID}"
                      />

例子

<s:select list="genderList"
          id="gender"
          name="gender"
          cssClass="listmenu validate-selection"
          listKey="name"
          listValue="details"
          headerKey=""
          value="userInfo.userPersonalInfo.gender"
          headerValue="Please choose one."
          ></s:select>
于 2013-03-13T11:39:26.000 回答
-1

实际上问题出在您的 s:select上,这里的值标签导致了问题。

试试这个

    <s:select list="listOfdevelopers" 
              name="developerID"
              headerKey="-1" 
              headerValue="Select Any Developer"
              listKey="developerID"               // your collection_element
              listValue="developer_name"          // your collection_element
    />
于 2013-03-13T06:02:17.283 回答