I am using Spring MVC to develop a small web app. I put variables into view, then from the front end, I display as jstl. In my main page I have:
function getExecJob(execid){
alert(execid);
var xmlhttp;
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("execDetailDiv").innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open("GET","execJobDetail.action?execId="+execid,true);
xmlhttp.send();
}
</script>
The execJobDetail.action
return page execJobDetail.jsp:
<div id="status_code_div">
HTTP Status Code Summary <br/>
<table width="523" id="http_status_code_table">
<tr>
<th width="268" >HTTP Status Code</th>
<th width="129" ># of Urls</th>
<th width="110" >%</th>
</tr>
<c:forEach var="entry" items="${reportMap}">
<tr>
<td scope="col" class="row_type"> ${entry.key}</td>
<td scope="col" class="row_value">${entry.value}</td>
<td scope="col" class="row_value">${(entry.value)*1.0/toal}</td>
</tr>
</c:forEach>
</table>
</div>
</c:if>
But it always return page leaving jstl thing blank. Could anyone please give me some suggestions?
That can happen if you haven't actually declared the JSTL taglib in top of JSP. This way it won't be parsed nor processed and end up as plain text in the generated HTML output.
Add the following line to top of JSP to get JSTL taglibs to run:
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>