Struts2 : The requested list key could not be resolved Error
I'm sorry for posting so many questions, I think I need to read up more...

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.

(This has nothing to do with the previous errors. Haven't got to solve that, and a new one is out :x)

I have a list that I want to populate to another, but in the process of doing so I got the error as titled :The requested list key could not be resolved as a collection/array/map/enumeration/iterator type.

I've looked around and tried the code but still it doesn't really seem to work. Here's my code:

JSP (and jquery):


    <s:select id="feb" name="feb" headerKey="-1" list="febList" 
    listKey="key" listValue="description" theme="simple" cssClass="formfields" />
    
    $('select#feb').change(function() {
        $.ajax({
            url: "AnnotateSearchList?feb="+$(this).val()+"&dept="+$("#dept").val(),
					dataType :'json',
					type:'GET',
					contentType: 'application/json',
					success : function(data) {
						alert('test');
					},
					error: function(){
						alert('Error');								
					}											
				})										
		});



The method:
   public String doGetSelectedList()
	{
		
		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<SelectItemsData> optList = new ArrayList<SelectItemsData>();
		
		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;
	
		
		
	}

//The Data holder for SelectItemsData:
    SelectItemsData(String key, String description);


struts/xml:


     <action name="AnnotateSearchList" class="mycompanyName.ajax.actions.ParetoChartCore"  method="doGetSelectedList">												
				<result type="stream">
				    <param name="contentType">application/json</param>	
				    <param name="inputName">output</param>	   
				</result>				
				<result name="success">/ParetoChart.jsp</result>								
			</action>




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.
Struts2 : The requested list key could not be resolved Error
===

I'm sorry for posting so many questions, I think I need to read up more...

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.

(This has nothing to do with the previous errors. Haven't got to solve that, and a new one is out :x)

I have a list that I want to populate to another, but in the process of doing so I got the error as titled :The requested list key could not be resolved as a collection/array/map/enumeration/iterator type.

I've looked around and tried the code but still it doesn't really seem to work. Here's my code:

JSP (and jquery):


    <s:select id="feb" name="feb" headerKey="-1" list="febList" 
    listKey="key" listValue="description" theme="simple" cssClass="formfields" />
    
    $('select#feb').change(function() {
        $.ajax({
            url: "AnnotateSearchList?feb="+$(this).val()+"&dept="+$("#dept").val(),
					dataType :'json',
					type:'GET',
					contentType: 'application/json',
					success : function(data) {
						alert('test');
					},
					error: function(){
						alert('Error');								
					}											
				})										
		});



The method:
   public String doGetSelectedList()
	{
		
		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<SelectItemsData> optList = new ArrayList<SelectItemsData>();
		
		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;
	
		
		
	}

//The Data holder for SelectItemsData:
    SelectItemsData(String key, String description);


struts/xml:


     <action name="AnnotateSearchList" class="mycompanyName.ajax.actions.ParetoChartCore"  method="doGetSelectedList">												
				<result type="stream">
				    <param name="contentType">application/json</param>	
				    <param name="inputName">output</param>	   
				</result>				
				<result name="success">/ParetoChart.jsp</result>								
			</action>




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.