JSTL sql:param for Like statements
The JSTL sql:param tag is real handy to use inside the sql:query tag to supply parameters for sql statements like the following:
<sql:query var="result">
SELECT ORDER
FROM ORDERS
WHERE CUSTOMER_ID= ?
<sql:param value=’${param.id}’/>
</sql:query>
However, if you need to use the LIKE condition, the sql:param won’t work. The solution is to use the c:out tag followed by a percentage sign:
<sql:query var="result">
SELECT ORDER
FROM ORDERS
WHERE YEAR LIKE ‘<c:out value="${param.year}"/>%’
</sql:query>
