The first double quotation mark inside the value violates the value too soon. You should use singlequotes only to indicate strings in EL, not double letters. You should use doublequotes only to indicate HTML attribute values.
<button id="add" <c:out value="${empty var ? 'disabled="disabled"' : ''}"/>>
(please do not pay attention to the syntax of the Stackoverflow code syntax, it does not recognize the correct / EL tags, this is legally permissible)
Or, when you are on JSP 2.0 or later, you can simply leave this c:out for as long as there is no risk to XSS (this is not the case because you are printing a server-controlled value).
<button id="add" ${empty var ? 'disabled="disabled"' : ''}>
source share