tags:

views:

286

answers:

1

Why doesn't the following work:

<c:set var="formId" value="#${otherFormId}"/>

where

<c:set var="formId" value="# ${otherFormId}"/>
           notice the space ^

works fine (though is invalid for my purposes). Im trying to prepend ${otherFormId} with a # symbol (i.e. creating jquery id selector).

The first form ends up with

#${otherFormId}

literally in the output. How can I get the outcome I am after?

+1  A: 

Got the answer.

#{expr}

is an expression whose evaluation is deferred (something to do with JSF lifecycle requirements) and was introduced as part of the Unified EL. To get around my problem you now need to escape any literal #'s. e.g.

<c:set var="formId" value="\#${otherFormId}"/>