前提・実現したいこと
更新ボタンを押下したとき更新ボタンの横列の値1のみをservletに送りたい。
ソースコード内のproductList.product_id に2つの値(1,2)が格納されており、
その内の1つのみ(更新ボタンの横列のみの値)をservletへ送りたい。
また、それが不可能な場合、別な方法で同じような処理を行いたい。
一覧画面
↓ID2の更新ボタンを押下
更新画面
ID2 | 値1 | 値2 | 値3 | 更新 |
---|---|---|---|---|
1 | 2 | 3 | 更新ボタン |
発生している問題・エラーメッセージ
更新ボタンを押下したときID2のレコードを表示したいのにID1とID2のレコード両方が更新画面に表示される
該当のソースコード
JSP
1<%@ page language="java" contentType="text/html; charset=UTF-8" 2 pageEncoding="UTF-8"%> 3 4<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 5 6<!DOCTYPE html> 7<html> 8 <head> 9 <meta charset="utf-8"> 10 <title>在庫管理</title> 11 <link rel="stylesheet" type="text/css" href="css/style.css"> 12 </head> 13 14 <body> 15 <p>在庫管理システム</P> 16 <form action=""> 17 <input class="sbtn" type="image" alt="検索" src="img/sb.png" /> 18 </form> 19 <form action="ProductInfo.jsp"> 20 <input class="sptn" type="image" alt="新規登録" src="img/sp.png" /> 21 </form> 22 <br> 23 <table border="1"> 24 <tr> 25 <th>商品ID</th><th>画像</th><th>メーカー名</th><th>商品名</th> 26 <th>ジャンル</th><th>在庫数</th><th>販売個数</th><th>価格</th><th>更新</th> 27 </tr> 28 <c:forEach var="productList" items="${productList}"> 29 <tr> 30 <td>${productList.product_id }</td><td><img src="img/SW_E07_一覧用.png" alt="写真"></td> 31 <td>${productList.product_maker }</td><td>${productList.product_name }</td> 32 <td>${productList.product_genre_code }</td><td>${productList.product_stock }</td> 33 <td>${productList.product_sales }</td><td>${productList.product_price }</td> 34 <td align="center"><form action="/sample001/ProductUpdate"><input class="upd" type="submit" value="更新"></form></td> 35 </tr> 36 </c:forEach> 37 </table> 38 </body> 39</html> 40
補足情報(FW/ツールのバージョンなど)
一覧画面の値はDBから値を取得して表示しております。
回答1件
あなたの回答
tips
プレビュー