0
- 以下は私のHTMLコードです。私は
<sql:...>
を使用してデータベースからデータを取得し、さらに<c:forEach ...>
を使用して反復処理を行い、の範囲内にあるテキストの値として を含みます。 - 今、このようなテーブルに対して動的検索操作を実行したいと考えています。私は jqueryを使っていくつかのコードを試してみましたが、 に直接データを追加すると動作します。
<tr>${row.barcode}</tr>
。<td> <input type="text" value="${row.barcode}"> </td>
のコードは機能しません。
products.htmlHTMLのテキストボックスはtrのデータとして表示されます。検索文字列の入力時にそのようなテーブルに対して動的検索操作を実行するにはどうすればよいですか?
<html>
<label for="search">Search products :</label>
<input type="text" id="search" placeholder="Enter text to search">
<!-- Fetch table data -->
<sql:setDataSource var="myDataSource" driver="oracle.jdbc.OracleDriver" url="jdbc:oracle:thin:@10.1.56.49:1521:something" user="something" password="something"/>
<sql:query var="result" sql="select * from garageproducts" dataSource="${myDataSource}"/>
<table id="mytable">
<thead>
<tr>
<th>Mark</th>
<th>Barcode</th>
<th>Name</th>
<th>Brand</th>
<th>Stock</th>
<th>Cost</th>
</tr>
</thead>
<tbody>
<c:forEach var="row" items="${result.rows}">
<tr>
<td> <input type="checkbox"> </td>
<td> <input type="text" value="${row.barcode}"> </td>
<td> <input type="text" value="${row.name}"> </td>
<td> <input type="text" value="${row.brand}"> </td>
<td> <input type="text" value="${row.stock}"> </td>
<td> <input type="text" value="${row.cost}"> </td>
</tr>
</c:forEach>
</tbody>
</table>
</html>