欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

添加后臺list給前臺select標簽賦值簡單實現(xiàn)

 更新時間:2013年07月18日 17:53:58   作者:  
本文為大家介紹下通過添加后臺list怎么實現(xiàn)給前臺select標簽賦值,具體代碼如下,感興趣的朋友可以參考下哈
復(fù)制代碼 代碼如下:

$.ajax({
url : "user!findUserList.action",
type : "post",
success: function(data){
var jsonObj=eval("("+data+")");
$.each(jsonObj, function (i, item) {
jQuery("#userList").append("<option value="+ item.userId+">"+ item.userRealName+"</option>");
});
},
error: function(text) {}
});

復(fù)制代碼 代碼如下:

public void findUserList() throws IOException {
List<UserModel> roleuserList = userService.findUserList();
String json = JSONArray.fromObject(roleuserList).toString();
writeHtml(json);;
}

復(fù)制代碼 代碼如下:

protected void writeHtml(String strData) {
try {
response.setContentType("text/html; charset=UTF-8");
PrintWriter pw = response.getWriter();
pw.write(strData);
pw.flush();
pw.close();
} catch (IOException e) {
log.error("writeHtml()", e);
}
}

相關(guān)文章

最新評論