Can JSTL var names be given from expressions or should they be literal strings?

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>
+3
source share
1 answer

, has_firstName, hasFirstName.

1- JSTL-, .

+2

Source: https://habr.com/ru/post/1778331/


All Articles