以下我使用的代码
<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
谢谢
像这样更改您的查询:
select * from vsites where site like '%' || ? || '%'
您可以简单地使用:
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}