我正在从数据库中获取记录,并使用JSTL sql查询标记,然后foreach标记结果显示但我的问题是我想将这些结果用于其他sql查询。如何获取这些值并将其放入其他sql查询标签?
SELECT * FROM report WHERE report.`id` = (SELECT MAX(id) FROM report );
</sql:query>
<sql:query dataSource="${db}" var="c">
SELECT name from city where id = <!--2. WANT TO USE IT HERE? -->
</sql:query>
<table border="2" width="100%">
<tr>
<th>Report #</th>
<th>City #</th>
<th>Weather Condition #</th>
<th>Weather Type #</th>
<th>Date and Time</th>
</tr>
<c:forEach var="table" items="${rs.rows}">
<tr>
<td><c:out value="${table.id}"/></td>
<td><c:out value="${table.city}"/></td> <!--1. WANT TO GET THIS VALUE --->
<td><c:out value="${table.condtions}"/></td>
<td><c:out value="${table.type}"/></td>
<td><c:out value="${table.date}"/></td>
</tr>
</c:forEach>