I am new to JSTL and I want to generalize some functions that were used several times in one tag to a separate tag. My idea is to pass an array of strings to this tag. It's not a problem. But I also want to name some variables based on these lines so that I can reuse the results of expressions in the local area.
Example:
<c:set var="hasFirstName" value="false"/>
I want to check "hasFirstName" in different places of the tag. But the names will change depending on the input. So is there a way to do something like this?
<c:forTokens var="formName" items="firstName,middleName,lastName" delims=",">
<c:set var="has_${formName}" value="false"/>
</c:forTokens>
source
share