質問編集履歴
2
追加の質問をするためにソースコードを追加したため
test
CHANGED
File without changes
|
test
CHANGED
@@ -144,6 +144,44 @@
|
|
144
144
|
|
145
145
|
### 追記部分
|
146
146
|
|
147
|
+
```jsp
|
148
|
+
|
149
|
+
//この部分以外は変更していません
|
150
|
+
|
151
|
+
<%int loopcount = 0; %>//ループカウントの定義
|
152
|
+
|
153
|
+
<%for(Shift shift : shiftList) { //ループでシフトを代入、デフォルトの値で表示 %>
|
154
|
+
|
155
|
+
<tr align = "center">
|
156
|
+
|
157
|
+
<td><%=shift.getId()%></td>
|
158
|
+
|
159
|
+
<td><%=shift.getName()%></td>
|
160
|
+
|
161
|
+
<td><input type="text" size="3" value= "<%=shift.getMon()%>" name="monday<%=loopcount%>"></td>
|
162
|
+
|
163
|
+
<td><input type="text" size="3" value= "<%=shift.getTue()%>" name="tuesday<%=loopcount%>"></td>
|
164
|
+
|
165
|
+
<td><input type="text" size="3" value= "<%=shift.getWen()%>" name="wednesday<%=loopcount%>"></td>
|
166
|
+
|
167
|
+
<td><input type="text" size="3" value= "<%=shift.getThu()%>" name="thursday<%=loopcount%>"></td>
|
168
|
+
|
169
|
+
<td><input type="text" size="3" value= "<%=shift.getFri()%>" name="friday<%=loopcount%>"></td>
|
170
|
+
|
171
|
+
<td><input type="text" size="3" value= "<%=shift.getSat()%>" name="saturday<%=loopcount%>"></td>
|
172
|
+
|
173
|
+
<td><input type="text" size="3" value= "<%=shift.getSun()%>" name="sunday<%=loopcount%>"></td>
|
174
|
+
|
175
|
+
</tr>
|
176
|
+
|
177
|
+
<%loopcount++; %>//ループカウントの加算
|
178
|
+
|
179
|
+
<% } %>
|
180
|
+
|
181
|
+
<input type="hidden" value="<%=loopcount%>" name="shiftListCount">
|
182
|
+
|
183
|
+
```
|
184
|
+
|
147
185
|
```java
|
148
186
|
|
149
187
|
|
1
追加質問で、ソースコードを提示したかったため
test
CHANGED
File without changes
|
test
CHANGED
@@ -141,3 +141,35 @@
|
|
141
141
|
|
142
142
|
|
143
143
|
```
|
144
|
+
|
145
|
+
### 追記部分
|
146
|
+
|
147
|
+
```java
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
//UPDATE文を準備(IDの指定方法を教えていただきたいです)
|
152
|
+
|
153
|
+
Statement stmt = conn.createStatement();
|
154
|
+
|
155
|
+
for(int i = 0;i < (int)Integer.parseInt(request.getParameter("shiftListCount"));i++){
|
156
|
+
|
157
|
+
monday = request.getParameter("monday"+i);
|
158
|
+
|
159
|
+
tuesday = request.getParameter("tuesday"+i);
|
160
|
+
|
161
|
+
wednesday = request.getParameter("wednesday"+i);
|
162
|
+
|
163
|
+
thursday = request.getParameter("thursday"+i);
|
164
|
+
|
165
|
+
friday = request.getParameter("friday"+i);
|
166
|
+
|
167
|
+
saturday = request.getParameter("saturday"+i);
|
168
|
+
|
169
|
+
sunday = request.getParameter("sunday"+i);
|
170
|
+
|
171
|
+
stmt.executeUpdate("UPDATE SHIFT SET MON = '"+monday+"',TUE = '"+tuesday+"' ,WEN ='"+wednesday+"' ,THU ='"+thursday+"', FRI = '"+friday+"', SAT = '"+saturday+"', SUN = '"+sunday+"' WHERE ID = "+i+1 );
|
172
|
+
|
173
|
+
}
|
174
|
+
|
175
|
+
```
|