Hi,

I'm trying to display data in a drop-down but no success till now. I checked
online documents and other examples but somehow they are not working for me.

Here is how I have implemented the code:

*Action class*

 private String countryId;

 private List<Object> countryList = new ArrayList<Object>(0);

 public String getCountryId() {
  return countryId;
 }

 public void setCountryId(String countryId) {
  this.countryId = countryId;
 }

 public List<Object> getCountryList() {
  return countryList;
 }

 public void setCountryList(List<Object> countryList) {
  this.countryList = countryList;
 }

 // This method is invoked before the JSP is displayed
 public String load() throws ApplicationException {
  CountryVO countryVO = new CountryVO();
  countryVO.setCountryKey(1);
  countryVO.setCountryCode("IN");
  countryVO.setCountryName("India");

  List<Object> countryList = new ArrayList<Object>(0);
  countryList.add(countryVO);
  this.setCountryList(countryList);

  this.userVO.setUserId(lUserId);
  this.userVO = (UserVO) userService.load(userVO);

  return DISPLAY;
 }

*JSP*
 <tr>
  <td>
   <s:label value="%{getText('country')}"/>
  </td>
  <td>
   <s:select name="countryId" list="countryList"
listKey="countryVO.countryKey" listValue="countryVO.CountryName"/>
  </td>
 </tr>

On page I don't see any data in drop-down. Help is appreciated.

Thanks in advance

-- 
Regards,
Himanshu Rathore

Reply via email to