title: Struts 2 Select tag error
body: <p>I am new to Struts2. I want to compare JSTL's <code>c</code> tag and Struts2 <code>s</code> tag which one is easy to use... My code as below</p>
  
  <p>ListDepartmentNameAction.java</p>
  
  <pre><code>package actions;
  
  import java.util.List;
  import org.apache.log4j.Logger;
  import org.hibernate.mapping.Array;
  import com.opensymphony.xwork2.ActionSupport;
  import service.ListDepNameService;
  
  public class ListDepartmentNameAction extends ActionSupport{
  
  private static Logger log = Logger.getLogger(ListDepartmentNameAction.class);
  ListDepNameService listDepNameService;
  private List&lt;String&gt; allDNlist ;
  
  public String execute() {
  
      allDNlist = listDepNameService.ListAllDepName();
      for (String ss : allDNlist) {
          System.out.println(ss);
      }
      log.info(allDNlist);
      return "success";
  
  }
  
  public ListDepNameService getListDepNameService() {
      return listDepNameService;
  }
  
  public void setListDepNameService(ListDepNameService listDepNameService) {
      this.listDepNameService = listDepNameService;
  }
  
  public List&lt;String&gt; getAllDNlist() {
      return allDNlist;
  }
  
  public void setAllDNlist(List&lt;String&gt; allDNlist) {
      this.allDNlist = allDNlist;
  }   
  }
  </code></pre>
  
  <p>query.jsp</p>
  
  <pre><code>&lt;%@ page language="java" import="java.util.*" contentType="text/html; charset=UTF-8"      pageEncoding="UTF-8" %&gt;
  &lt;%@ taglib prefix="s" uri="/struts-tags" %&gt;
  &lt;%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %&gt;
  &lt;html&gt;
      &lt;head&gt;
      &lt;s:head /&gt;
        &lt;h1 align="center" id="h1"&gt;&lt;/h1&gt;
  &lt;body&gt;
  
     &lt;s:form action="listDepName" id="form" method="post"&gt;                
          &lt;input name="Button" type="submit" id="listsubmit" value="List all Department Name" 
          onclick="javascirpt:abc(this)"/&gt;                       
     &lt;/s:form&gt;
  
     &lt;select&gt;
          &lt;c:forEach items="${allDNlist}" var="item"&gt;
              &lt;option value="abc" &gt;${item}&lt;/option&gt;
          &lt;/c:forEach&gt;
     &lt;/select&gt;
  
    &lt;s:if test="%{allDNlist==null}"&gt;456&lt;/s:if&gt;
    &lt;s:else&gt;&lt;s:select name="xxx" list="allDNlist" /&gt;&lt;/s:else&gt; &lt;!-- 1st --&gt;
  
    &lt;s:select name="xyz" list="allDNlist" /&gt; &lt;!-- 2nd --&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>"allDNlist" can get value from action class,therefore, JSTL c tag work properly.
  I don't understand why the "1st" struts2 select tag work fine, but "2nd" select <code>s</code> tag doesn't work, and got message like this</p>
  
  <pre><code> HTTP Status 500 - tag 'select', field 'list', name 'xyz': The requested list key 'allDNlist' could not be resolved as a collection/array/map/enumeration/iterator type. Example: people or people.{name} - [unknown location]
  </code></pre>
  
  <p>even I comment() the "2nd" select s tag, I still got same error message as above, only remove it.</p>