title: JSTL: Set and Compare JSTL variable
body: <p>I have a list of ADs and I want to group them by <code>StartOn (timestamp)</code>. The list is sorted by StartOn already. So I loop through the list, <code>if startOnCur != ad.StartOn</code>, I print the timestamp and assign StartOn to <code>startOnCur (temp var)</code>. </p>
  
  <p>The problem is that I am not able to assign <code>ad.StartOn</code> to <code>ad.StartOn</code>. What am I missing? Thanks!</p>
  
  <pre><code>&lt;c:set var="startOnCur" value=""/&gt;
  &lt;c:forEach items="${ads}" var="ad" &gt;            
    &lt;c:if test="${startOnCur != ad.startOn}"&gt;
    &lt;legend&gt;&lt;fmt:formatDate pattern="EEE. MMM. d" value="${ad.startOn}" /&gt;&lt;/legend&gt;
    &lt;c:set var="startOnCur" value="${ad.startOn}" scope="session"/&gt;
    &lt;/c:if&gt;
  &lt;/c:forEach&gt;
  </code></pre>