怎么将从servlet拿到的list集合用json数据显示到jsp页面?

2024-12-31 06:31:06
推荐回答(1个)
回答1:

可以这样做,返回类型为html格式,把集合显示做成单个页面(userlist.jsp),用div包含该页面,后台跳转到该页面,把div的html替换成返回来的html,页面:




var submitUrl = "AdminMangeServlet";

$.ajax({
url: submitUrl,
type: "POST",
async: false,
cache: false,
globle: false,
dataType: "html",
beforeSend: function(XMLHttpRequest){},
success: function(data, textStatus){
$("#list_div").html(data);
},
error: function(XMLHttpRequest,textStatus,errorThrown){},
complete:function(msg){}
});