Skip to content

Changing value of <c:set jstl tag

I am using the following expression on my jsp

<c:set var="flag" value="false" />

I have a condition inside a for each loop where I might want to change this variable to true. Is there a way to do this. I’ve looked everywhere but unable to find a solution.


Here is the sample code you are looking for:

   <c:when test="${yourcondition}">
      <c:set var="flag" value="true" />
      <c:set var="flag" value="false" />