jsp - Can JSTL var names be set from expressions or do they have to be literal strings? -


i'm new jstl , want generalize functionality that's used multiple times in 1 tag separate tag. idea pass tag array of strings. that's no problem. want name variables based on strings can reuse results of expressions within local scope.

example:

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

i want test "hasfirstname" @ various places within tag. names change depending upon input. there way this?

<c:fortokens var="formname" items="firstname,middlename,lastname" delims=",">         <c:set var="has_${formname}" value="false"/> </c:fortokens> 

your approach work, stored has_firstname, not hasfirstname.

you could substring , uppercase 1st character jstl functions, that's clumsy.


Comments

Popular posts from this blog

Add email recipient to all new Trac tickets -

400 Bad Request on Apache/PHP AddHandler wrapper -

php - Change action and image src url's with jQuery -