Murphy1976
Murphy1976

Reputation: 1475

JSP If YES then Increment

I have a set variable "vColspan" which has a value of 4

I also have two if conditionals, that if they are NOT EMPTY, I would like to them to EACH add 1 to vColSpan

Then after those two conditional have been checked, I will set the colspan of my table with the variable vColspan.

What is the proper syntax to increment a c:set variable?

Here is my code so far:

<c:set var="vColspan" scope="session" value="4"/>

<c:if test="${!empty vs.Data1}">
   what do I put here?                          
</c:if>

<c:if test="${!empty vl.Data2}">
    and what do I put here?                 
</c:if>

<td colspan="<c:out value="${vColspan}"/>">

Upvotes: 0

Views: 126

Answers (1)

Pshemo
Pshemo

Reputation: 124245

How about something like

<c:set var="vColspan" scope="session" value="${vColspan + 1}" />

Upvotes: 1

Related Questions