如何使用JSTL从JSP页面获取值 从kutuphane.odunc_kitaplar中选择*其中eposta=?
如何将我在标记中识别的值放入sql查询以从数据库获取列表?尝试以下操作:如何使用JSTL从JSP页面获取值 从kutuphane.odunc_kitaplar中选择*其中eposta=?,jsp,jstl,Jsp,Jstl,如何将我在标记中识别的值放入sql查询以从数据库获取列表?尝试以下操作: <% com.BeanPaket.kontrolBean kontrol = new kontrolBean(); String epostavalue = kontrol.getEposta(); %> <sql:query var="kutuphane" dataSource="${dataSource}"> SELECT * FROM kutuphane.odunc_
<%
com.BeanPaket.kontrolBean kontrol = new kontrolBean();
String epostavalue = kontrol.getEposta();
%>
<sql:query var="kutuphane" dataSource="${dataSource}">
SELECT * FROM kutuphane.odunc_kitaplar WHERE eposta = ?
</sql:query>
从kutuphane.odunc_kitaplar中选择*其中eposta=?
Ok我解决了这个问题,没有使用标签。我们也可以使用这个代码;其中,eposta='将参数化查询与sql:param一起使用,而不使用直接查询()。它可能很脆弱。
<sql:query var="kutuphane" dataSource="${dataSource}">
SELECT * FROM kutuphane.odunc_kitaplar WHERE eposta = ?
<sql:param value="${epostavalue}" />
</sql:query>