Mình có đoạn sử dụng Ajax để lấy 1 list và điền vào nội dung cho trang jsp như sau:
$.ajax({
type : 'GET',
headers : {
Accept : "application/json; charset=utf-8",
"Content-Type" : "application/json; charset=utf-8"
},
url : '${pageContext.request.contextPath}/ajax/'+ statusId,
success : function(result) {
var s = "<table class=\"table\"><thead><tr><th scope=\"col\">#</th><th scope=\"col\">Số phiếu</th><th scope=\"col\">Ngày lập</th><th scope=\"col\">Yêu cầu</th><th scope=\"col\">Ngày gửi</th><th scope=\"col\">Người gửi</th><th scope=\"col\">Nội dung</th><th scope=\"col\">Lý do</th><th scope=\"col\">Trạng thái</th><th scope=\"col\">Chức năng</th></tr></thead><tbody>";
var stt = 1;
for (var i=0; i<result.length; i++){
stt+=i;
s+= "<tr><th scope=\"row\">" + stt +"</th><td>"+ result[i].soPhieu+"</td>";
s+= "<td><fmt:formatDate value=\"${"+ result[i].ngayLap+"}\" pattern=\"dd/MM/yyyy\" /></td></tr>";
}
s+= "</tbody></table>";
$('#content').html(s);
},
error : function(message) {
$('#result').html(message);
}
})
Tuy nhiên khi chạy báo lỗi: org.apache.jasper.JasperException: /WEB-INF/views/list.jsp (line: 53, column: 49) quote symbol expected
Mình đã tìm hiểu thì nó báo lỗi ở dòng:
s+= "<td><fmt:formatDate value=\"${"+ result[i].ngayLap+"}\" pattern=\"dd/MM/yyyy\" /></td></tr>";
Các bạn cho mình hỏi mình viết như thế có đúng ko ?
83% thành viên diễn đàn không hỏi bài tập, còn bạn thì sao?