aturetsky
asked on
null list in c:forEach prevents even the static html outside the loop from rendering
I've got following code in my jsp:
<c:forEach var="update"
items="${rfqAnalysisFormBe an.rfq.rfq UpdateHist oryList}"
varStatus="indexStatus">
<c:if test="${indexStatus.count % 2 == 1}">
<tr border="0" cellpadding="0" cellspacing="0" class="bg_grey">
</c:if>
<c:if test="${indexStatus.count % 2 == 0}">
<tr border="0" cellpadding="0" cellspacing="0">
</c:if>
<td height="17" align="center">
<div align="left"> On  ;<fmt:form atDate
value="${update.updateDate }" pattern="MM/dd/yyyy" /> the date
was changed to <fmt:formatDate value="${update.bidCloseDa te}"
pattern="MM/dd/yyyy" /> because <c:out
value="${update.updateComm ent}" /></div>
</td>
</tr>
</c:forEach>
Now, if rfqAnalysisFormBean.rfq.rf qUpdateHis toryList is null, not only do the elements inside the loop not render (which is correct), but the rest of the page, including the static html elements do not render as well. So I said, ok, let me put an if clause before the loop to check for null list (see below), hoping it should solve my problem, but that didn't help either. What do you think is happening?
<c:if test="${rfqAnalysisFormBea n.rfq.rfqU pdateHisto ryList != null}">
<c:forEach var="update"
items="${rfqAnalysisFormBe an.rfq.rfq UpdateHist oryList}"
varStatus="indexStatus">
<c:if test="${indexStatus.count % 2 == 1}">
<tr border="0" cellpadding="0" cellspacing="0" class="bg_grey">
</c:if>
<c:if test="${indexStatus.count % 2 == 0}">
<tr border="0" cellpadding="0" cellspacing="0">
</c:if>
<td height="17" align="center">
<div align="left"> On  ;<fmt:form atDate
value="${update.updateDate }" pattern="MM/dd/yyyy" /> the date
was changed to <fmt:formatDate value="${update.bidCloseDa te}"
pattern="MM/dd/yyyy" /> because <c:out
value="${update.updateComm ent}" /></div>
</td>
</tr>
</c:forEach>
</c:if>
<c:forEach var="update"
items="${rfqAnalysisFormBe
varStatus="indexStatus">
<c:if test="${indexStatus.count % 2 == 1}">
<tr border="0" cellpadding="0" cellspacing="0" class="bg_grey">
</c:if>
<c:if test="${indexStatus.count % 2 == 0}">
<tr border="0" cellpadding="0" cellspacing="0">
</c:if>
<td height="17" align="center">
<div align="left"> On 
value="${update.updateDate
was changed to <fmt:formatDate value="${update.bidCloseDa
pattern="MM/dd/yyyy" /> because <c:out
value="${update.updateComm
</td>
</tr>
</c:forEach>
Now, if rfqAnalysisFormBean.rfq.rf
<c:if test="${rfqAnalysisFormBea
<c:forEach var="update"
items="${rfqAnalysisFormBe
varStatus="indexStatus">
<c:if test="${indexStatus.count % 2 == 1}">
<tr border="0" cellpadding="0" cellspacing="0" class="bg_grey">
</c:if>
<c:if test="${indexStatus.count % 2 == 0}">
<tr border="0" cellpadding="0" cellspacing="0">
</c:if>
<td height="17" align="center">
<div align="left"> On 
value="${update.updateDate
was changed to <fmt:formatDate value="${update.bidCloseDa
pattern="MM/dd/yyyy" /> because <c:out
value="${update.updateComm
</td>
</tr>
</c:forEach>
</c:if>
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I've been working urgently on something else - but I'll check this out soon and let you know what happens
Thanks.
Thanks.
ASKER
hmm, for some strange reason - I tried recreating the problem, but now everything except for the list shows up - as is appropriate - so I can no longer replicate the symptoms - manuel_m's suggestion was useful in other regards, so I'll mark it as the accepted answer, while giving suprapto45 points for participation
ASKER