以下代码我用
<sql:query dataSource="jdbc/crawl" var="rs">
select * from vsites where site like %?%
<sql:param value="${param.key}"/>
</sql:query>
但它抛出异常
我的网址是:http://localhost/c/2.jsp?key=math
感谢
答案 0 :(得分:2)
更改您的查询:
select * from vsites where site like '%' || ? || '%'
答案 1 :(得分:0)
您可以像这样使用
:SELECT * FROM question WHERE lower(question) LIKE '%${query}%';
示例:
<sql:query dataSource="${dbsource}" var="question">
SELECT * FROM question WHERE lower(question) LIKE '%${query}%';
</sql:query>
<c:forEach items="${question.rows}" var="q">
<c:out value="${q.q_id}"/>,<c:out value="${q.question},<c:out value="${q.question}"/>
</c:forEach>
you can replace <c:out value="${q.value}"/> by simply ${q.value}