I recently upgraded to Struts 2.2.3 and noticing that result types of
JSON are not behaving the same way as they did before. For example, the
following action is setup:
--- Action Class ---
package com.setech.dw.repair.web.ajax;
public class StatusAction implements ActionSupport
{
private Map<String,String> list = new LinkedHashMap<String,String>();
private String type;
@Autowired
private IRepairService service;
public void setType(String type) {
this.type = type;
}
public Map<String,String> getList() {
return list;
}
public String execute()
throws Exception {
List<StatusCode> statuses = service.getStatusCodesByType(type);
for(StatusCode statusCode : statuses)
list.put(statusCode.getCode(),getText("repair.status."+statusCode.getCod
e().toLowerCase()));
return SUCCESS;
}
}
--- Struts Action Mapping ---
<action name="statusSelectList"
class="com.setech.dw.repair.web.ajax.StatusAction">
<result name="success" type="json"/>
</action>
In the JSP; it is expecting to find variable "list" on the top of the
OGNL value stack which would be the action invoked. This worked fine
when I was using 2.1.8.1; however after upgrading to 2.2.3; I am finding
that the JSON response only contains the following:
[org.apache.struts2.json.JSONUtil]:
[JSON]{"com.opensymphony.xwork2.util.OgnlValueStack.MAP_IDENTIFIER_KEY":
""}
Was there some fundamental change that I have overlooked?
Chris
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]