title: Error in Select box
body: <p>This is my Assignemployee.jsp file code</p>
  
  <pre><code>&lt;s:form action="AssignEmployee" name="myForm"&gt;
  &lt;s:select name="pname" list="projectlist"  headerKey="0" label="Select a country" /&gt;
   &lt;s:submit/&gt;
   &lt;/s:form&gt;
  </code></pre>
  
  <p>This is my projectlist.java action file</p>
  
  <pre><code>package myPack;
  import java.sql.DriverManager;
  import java.sql.PreparedStatement;
  import java.sql.ResultSet;
  import java.util.ArrayList;
  import java.util.HashMap;
  import java.util.List;
  import java.util.Map;
  import javax.servlet.http.HttpServletRequest;
  import org.apache.struts2.interceptor.ApplicationAware;
  import org.apache.struts2.interceptor.ServletRequestAware;
  import com.opensymphony.xwork2.ActionSupport;
  import com.opensymphony.xwork2.Preparable;
  public class projectlist extends ActionSupport implements ServletRequestAware { 
  private static final long serialVersionUID = 1L;
  HttpServletRequest request;
  private List&lt;String&gt; projectlist;
  public List&lt;String&gt; getProjectlist() {
  return projectlist;
  }
  public void setProjectlist(List&lt;String&gt; projectlist) {
  this.projectlist = projectlist;
  }
  public void setServletRequest(HttpServletRequest request)
  {
  this.request = request;
  } 
  public HttpServletRequest getServletRequest(){
  return request;
  }
  public String getDefaultSearchEngine() {
  return "yahoo.com";
  }
  public projectlist()
  {       
  try
  {
  Class.forName("com.mysql.jdbc.Driver"); 
  java.sql.Connection con=DriverManager.getConnection("jdbc:mysql:///pmt","root","shree");    
  ps=con.prepareStatement("select * from addproject");
  ResultSet res = ps.executeQuery();      
  while(res.next()) 
  {   
  projectlist = new ArrayList&lt;String&gt;();
  projectlist.add(res.getString("pname"));
  }
  ps.close();         
  con.close();
  } 
  catch(Exception e)
  { 
  e.printStackTrace(); 
  }
  }
  public String execute()throws Exception
  {
  return SUCCESS;
  }
  public String display() {
  return NONE;
  }
  }
  </code></pre>
  
  <p>And This is struts.xml</p>
  
  <pre><code>&lt;action name="AssignEmployee" class="myPack.projectlist" method="display"&gt;
      &lt;result name="success"&gt;assignemployee.jsp&lt;/result&gt;
  &lt;/action&gt;
  </code></pre>
  
  <p>When i am running application i get an error like</p>
  
  <blockquote>
    <p>SEVERE: Servlet.service() for servlet [jsp] in context with path [/PTMS] threw       exception [tag 'select', field 'list', name 'pname': The requested list key 'projectlist' could not be resolved as a collection/array/map/enumeration/iterator type. Example: people or people.{name} - [unknown location]] with root cause
    tag 'select', field 'list', name 'pname': The requested list key 'projectlist' could not be resolved as a collection/array/map/enumeration/iterator type. Example: people or people.{name} - [unknown location]</p>
  </blockquote>
  
  <p>How to solve this error?</p>