If you're already on EL 3.0 (Java EE 7; WildFly, Tomcat 8, GlassFish 4, etc), then you could use the new +=
operator for this:
<c:out value="${empty value ? 'none' : value += ' enabled'}" />
If you're however not on EL 3.0 yet, and the value
is a genuine java.lang.String
instance (and thus not e.g. java.lang.Long
), then use EL 2.2 (Java EE 7; JBoss AS 6/7, Tomcat 7, GlassFish 3, etc) capability of invoking direct methods with arguments, which you then apply on String#concat()
:
<c:out value="${empty value ? 'none' : value.concat(' enabled')}" />
Or if you're even not on EL 2.2 yet, then use JSTL <c:set>
to create a new EL variable with the concatenated values just inlined in value:
<c:set var="enabled" value="${value} enabled" />
<c:out value="${empty value ? 'none' : enabled}" />
${'this'.concat(' is').concat(' a').concat(' test!')}
would be the normal form. – Zonked