Note that there are some explanatory texts on larger screens.

plurals
  1. POStruts2 : The requested list key could not be resolved Error
    text
    copied!<p>I'm sorry for posting so many questions, I think I need to read up more...</p> <p>But first of all I was wondering if you guys can help me on this cos it's been bugging me for quite some time already and have been wondering why it's not working.</p> <p>(This has nothing to do with the previous errors. Haven't got to solve that, and a new one is out :x)</p> <p>I have a list that I want to populate to another, but in the process of doing so I got the error as titled :<code>The requested list key could not be resolved as a collection/array/map/enumeration/iterator type.</code></p> <p>I've looked around and tried the code but still it doesn't really seem to work. Here's my code:</p> <p>JSP (and jquery):</p> <pre><code>&lt;s:select id="feb" name="feb" headerKey="-1" list="febList" listKey="key" listValue="description" theme="simple" cssClass="formfields" /&gt; $('select#feb').change(function() { $.ajax({ url: "AnnotateSearchList?feb="+$(this).val()+"&amp;dept="+$("#dept").val(), dataType :'json', type:'GET', contentType: 'application/json', success : function(data) { alert('test'); }, error: function(){ alert('Error'); } }) }); </code></pre> <p>The method: public String doGetSelectedList() {</p> <pre><code> this.output = new StringBufferInputStream(""); SimpleDateFormat sdf = new SimpleDateFormat("dd-MMM-yyyy"); Calendar startCalendar = Calendar.getInstance(); startCalendar.add(Calendar.DAY_OF_YEAR, -3); Calendar endCalendar = Calendar.getInstance(); if (this.startDate == null || this.startDate.equals("")) { this.startDate = sdf.format(startCalendar.getTime()).toString(); } if (this.endDate == null || this.endDate.equals("")) { this.endDate = sdf.format(endCalendar.getTime()).toString(); } System.out.println("Feb "+this.feb); System.out.println("Dept "+this.dept); this.optionList =xxx.getList(this.feb, this.dept, this.startDate, this.endDate); ArrayList&lt;SelectItemsData&gt; optList = new ArrayList&lt;SelectItemsData&gt;(); for(String list : optionList){ optList.add(new SelectItemsData(list, list)); } System.out.println("Size of list: "+this.optionList.size()); System.out.println(optList.size()); String json = new Gson().toJson(optList); logger.sendMessage(getClass().getSimpleName(), LogHandler.INFO, json); //System.out.println(json); try { response.setContentType("Application/json"); response.getWriter().write(json); this.output = new StringBufferInputStream(json); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } return SUCCESS; } </code></pre> <p>//The Data holder for SelectItemsData: SelectItemsData(String key, String description);</p> <p>struts/xml:</p> <pre><code> &lt;action name="AnnotateSearchList" class="mycompanyName.ajax.actions.ParetoChartCore" method="doGetSelectedList"&gt; &lt;result type="stream"&gt; &lt;param name="contentType"&gt;application/json&lt;/param&gt; &lt;param name="inputName"&gt;output&lt;/param&gt; &lt;/result&gt; &lt;result name="success"&gt;/ParetoChart.jsp&lt;/result&gt; &lt;/action&gt; </code></pre> <p>Am I going on wrong anywhere? My results are actually returning to the same page, so I thought that might be the possible cause of the error. Thanks.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload