日期:2014-05-18 浏览次数:20656 次
public class Department {
private String deptName;
//省略get/set方法
}
public String execute() throws Exception
{
list = new ArrayList<Department>();
list.add(new Department("计科系"));
list.add(new Department("信管系"));
list.add(new Department("数艺系"));
list.add(new Department("外语系"));
return SUCCESS;
}
<package name="default" extends="json-default" namespace="/">
<action name="myjson" class="com.ccniit.ajax.TestAjax">
<result type="json">
<param name="noCache">true</param>
<param name="excludeNullProperties">true</param>
</result>
</action>
</package>
$(function() {
$("#get").click(function() {
$.getJSON("myjson.action", function(data) {
for ( var s in data) {
alert(s + "--->>" + s[0].deptName);
}
});
});