I am trying to create an array object based on data that came from the servlet since trying to c:if with a Javascript variable was invalid. The session variable 'preeditList' is an array of 3 fields. Here is the following array in my JSP:
var checkedArray =
[
<c:forEach items="${preeditList}" var="preeditList" varStatus="status">
{"schedulekey": '${preeditList.getCHK_SCHEDULE_NUMBER()}',
"contractkey": '${preeditList.getCHK_CONTRACT_YEAR()}',
"prevStatus": '${preeditList.getCHK_STATUS()}'
}
<c:if test="${!status.last}">
,
</c:if>
</c:forEach>
] ;
This is giving me lots of syntax errors saying that a comma is expected. First of all should the array come out looking like this or completely screwed up:
var checkArray = [
{
"schedulekey": "43080",
"contractkey": "2016",
"prevStatus": "RP"
},
{
"schedulekey": "43070",
"contractkey": "2016",
"prevStatus": "CP"
}
] ;
If this is fine then what I wrong on my syntax to pull this off.
Thanks again