title: Load Map into jsp to populate drop down list in struts2
body: <p>At my work I have to maintain some web applications written by a previous developer and I recently have to upgrade Struts from the version 2.1.6 to 2.3.32</p>
  
  <p>The update goes mostly well, the only real change I had to make in the application was changing the old </p>
  
  <pre><code>&lt;filter&gt;
      &lt;filter-name&gt;struts2&lt;/filter-name&gt;
      &lt;filter-class&gt;org.apache.struts2.dispatcher.FilterDispatcher&lt;/filter-class&gt;
  &lt;/filter&gt;
  </code></pre>
  
  <p>to </p>
  
  <pre><code>&lt;filter&gt;
      &lt;filter-name&gt;struts2&lt;/filter-name&gt;
      &lt;filter-class&gt;org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter&lt;/filter-class&gt;
  &lt;/filter&gt;
  </code></pre>
  
  <p>in <strong>web.xml</strong>, but now the problem is that every drop down list populated by the application just fail with the sames Exception like theses ones:</p>
  
  <pre><code>mars 23, 2017 8:14:03 AM org.apache.catalina.core.ApplicationDispatcher invoke
  GRAVE: "Servlet.service()" pour la servlet jsp a lancé une exception
  tag 'select', field 'list', name 'QUALITE': The requested list key 'liste_Qualite' could not be resolved as a collection/array/map/enumeration/iterator type. Example: people or people.{name} - [unknown location]
      at org.apache.struts2.components.Component.fieldError(Component.java:263)
      at org.apache.struts2.components.Component.findValue(Component.java:356)
      at org.apache.struts2.components.ListUIBean.evaluateExtraParams(ListUIBean.java:82)
      at org.apache.struts2.components.Select.evaluateExtraParams(Select.java:105)
      at org.apache.struts2.components.UIBean.evaluateParams(UIBean.java:893)
      at org.apache.struts2.components.UIBean.end(UIBean.java:535)
      at org.apache.struts2.views.jsp.ComponentTagSupport.doEndTag(ComponentTagSupport.java:42)
      ...
  
  
  
  mars 23, 2017 8:14:03 AM org.apache.struts2.dispatcher.DefaultDispatcherErrorHandler error
  GRAVE: Exception occurred during processing request: tag 'select', field 'list', name 'QUALITE': The requested list key 'liste_Qualite' could not be resolved as a collection/array/map/enumeration/iterator type. Example: people or people.{name} - [unknown location]
  org.apache.jasper.JasperException: tag 'select', field 'list', name 'QUALITE': The requested list key 'liste_Qualite' could not be resolved as a collection/array/map/enumeration/iterator type. Example: people or people.{name} - [unknown location]
      at org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:538)
      at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:430)
      at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
      at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:723)
      ...
  
  
  
  mars 23, 2017 8:14:03 AM org.apache.catalina.core.StandardWrapperValve invoke
  GRAVE: "Servlet.service()" pour la servlet default a généré une exception
  java.lang.IllegalStateException
      at org.apache.catalina.connector.ResponseFacade.sendError(ResponseFacade.java:407)
      at org.apache.struts2.dispatcher.DefaultDispatcherErrorHandler.sendErrorResponse(DefaultDispatcherErrorHandler.java:80)
      at org.apache.struts2.dispatcher.DefaultDispatcherErrorHandler.handleError(DefaultDispatcherErrorHandler.java:59)
      at org.apache.struts2.dispatcher.Dispatcher.sendError(Dispatcher.java:920)
      at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:587)
      at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:81)
      at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:99)
      ...
  </code></pre>
  
  <p>The last Exception make me think the problem come from the change of filter in web.xml since the rest of the application have not been modified. But after one day of searching I can't seem to find what to do to make the application work again.</p>
  
  <p>The Map are set initialized and filled in this file:</p>
  
  <pre><code>public class OrdreMissionAction_ext extends ActionSupport {
      ...
      Map&lt;String,String&gt; liste_Qualite = new HashMap&lt;String,String&gt;();
      public Map&lt;String,String&gt; getliste_Qualite() {
          return liste_Qualite;
      }
      ...
      public String init_om() throws NamingException, IOException{
          liste_Qualite = new LinkedHashMap&lt;String,String&gt;();      
          liste_Qualite.put("IAT","Personnel IATSS");
          liste_Qualite.put("PSD","Personnel uB Postdoctorant");
          liste_Qualite.put("ENS","Personnel uB Ens/Chercheur"); 
          ....
          return SUCCESS;
      }
      ...
  }
  </code></pre>
  
  <p>Declared in <strong>struts.xml</strong> that way:</p>
  
  <pre><code>&lt;package name="actions_ext"  namespace="/gom_ext" extends="struts-default"&gt;
      &lt;default-action-ref name="saisir_Om"&gt;&lt;/default-action-ref&gt;  
      &lt;action name="saisir_Om" class="beansActions.OrdreMissionAction_ext" method="init_om"&gt;
          &lt;interceptor-ref name="StackForms"/&gt;
          &lt;result name="success"&gt;/WEB-INF/gom_ext/saisir_Om.jsp&lt;/result&gt;
      &lt;/action&gt;
      ...
  &lt;/package&gt;
  </code></pre>
  
  <p>And call in the jsp with this sort of line:</p>
  
  <pre><code>&lt;s:select label="Choisissez une qualité" headerKey="" headerValue="Choisissez une qualité" list="liste_Qualite" name="QUALITE" id="QUALITE" tabindex="3" onchange="Collab_ext(this.value)"/&gt;
  </code></pre>
  
  <p>After looking at a countless number of examples and questions asked here I did not see any errors in theses declarations and I still don't have figured out how to fix it yet. Have you some idea about what goes wrong?</p>
  
  <hr>
  
  <p>The page is called via it's action <a href="http://example.com/gom_ext/saisir_Om" rel="nofollow noreferrer">http://example.com/gom_ext/saisir_Om</a> so the init_om() function is called and the Map filled. </p>
  
  <p>Before the Exceptions happens, the application start to be sent to the browser and if I remove the selects, the pages seem to work correctly out of that. It seem that's the only problem is just the jsp that don't success to retrieve the differents lists.</p>