這篇文章給大家分享的是有關(guān)如何添加后臺(tái)list給前臺(tái)select標(biāo)簽賦值的內(nèi)容。小編覺得挺實(shí)用的,因此分享給大家做個(gè)參考,一起跟隨小編過來看看吧。
代碼如下:
$.ajax({
url : "user!findUserList.action",
type : "post",
success: function(data){
var jsonObj=eval("("+data+")");
$.each(jsonObj, function (i, item) {
jQuery("#userList").append("");
});
},
error: function(text) {}
});
代碼如下:
public void findUserList() throws IOException {
List
String json = JSONArray.fromObject(roleuserList).toString();
writeHtml(json);;
}
代碼如下:
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)于“如何添加后臺(tái)list給前臺(tái)select標(biāo)簽賦值”這篇文章就分享到這里了,希望以上內(nèi)容可以對(duì)大家有一定的幫助,讓大家可以學(xué)到更多知識(shí),如果覺得文章不錯(cuò),可以把它分享出去讓更多的人看到吧!