質問編集履歴
3
追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -16,10 +16,6 @@
|
|
16
16
|
|
17
17
|
###追記内容
|
18
18
|
|
19
|
-
自分で試した内容について参考にさせて頂いたURL
|
20
|
-
|
21
|
-
http://struts.wasureppoi.com/jstl/02_if.html
|
22
|
-
|
23
19
|
![イメージ説明](b057bb18a0d0865971583a36070749ea.png)
|
24
20
|
|
25
21
|
JSP、以前の内容から色々書き直しているのでコード修正しました。
|
@@ -94,13 +90,13 @@
|
|
94
90
|
|
95
91
|
<tr>
|
96
92
|
|
97
|
-
<td class ="area"
|
93
|
+
<td class ="area"><c:out value="${truck.m_wholesale_area}"></c:out></td>
|
98
|
-
|
94
|
+
|
99
|
-
<td class ="area"
|
95
|
+
<td class ="area"><c:out value="${truck.stack_area}"></c:out></td>
|
100
|
-
|
96
|
+
|
101
|
-
<td class ="area"
|
97
|
+
<td class ="area"><c:out value="${truck.wholesale_area}"></c:out></td>
|
102
|
-
|
98
|
+
|
103
|
-
<td class ="area"
|
99
|
+
<td class ="area"><c:out value="${truck.e_stack_area}"></c:out></td>
|
104
100
|
|
105
101
|
</tr>
|
106
102
|
|
@@ -110,13 +106,13 @@
|
|
110
106
|
|
111
107
|
<tr>
|
112
108
|
|
113
|
-
<td class ="area"
|
109
|
+
<td class ="area"><c:out value="${truck.m_wholesale_area}"></c:out></td>
|
114
|
-
|
110
|
+
|
115
|
-
<td class ="area"
|
111
|
+
<td class ="area"><c:out value="${truck.stack_area}"></c:out></td>
|
116
|
-
|
112
|
+
|
117
|
-
<td class ="area"
|
113
|
+
<td class ="area"><c:out value="${truck.wholesale_area}"></c:out></td>
|
118
|
-
|
114
|
+
|
119
|
-
<td class ="area"
|
115
|
+
<td class ="area"><c:out value="${truck.e_stack_area}"></c:out></td>
|
120
116
|
|
121
117
|
</tr>
|
122
118
|
|
@@ -162,128 +158,272 @@
|
|
162
158
|
|
163
159
|
```Java
|
164
160
|
|
165
|
-
i
|
166
|
-
|
167
|
-
i
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
i
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
s
|
161
|
+
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
162
|
+
|
163
|
+
EntityManager em = DBUtil.createEntityManager();
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
List<Trucks> trucks = em.createNamedQuery("getAllTrucks",Trucks.class)
|
168
|
+
|
169
|
+
.getResultList();
|
170
|
+
|
171
|
+
|
172
|
+
|
173
|
+
long trucks_count = (long)em.createNamedQuery("getTrucksCount", Long.class)
|
174
|
+
|
175
|
+
.getSingleResult();
|
176
|
+
|
177
|
+
|
178
|
+
|
179
|
+
em.close();
|
180
|
+
|
181
|
+
|
182
|
+
|
183
|
+
|
184
|
+
|
185
|
+
|
186
|
+
|
187
|
+
|
188
|
+
|
189
|
+
request.setAttribute("trucks", trucks);
|
190
|
+
|
191
|
+
request.setAttribute("trucks_count", trucks_count);
|
192
|
+
|
193
|
+
if(request.getSession().getAttribute("flush") != null) {
|
194
|
+
|
195
|
+
request.setAttribute("flush", request.getSession().getAttribute("flush"));
|
196
|
+
|
197
|
+
request.getSession().removeAttribute("flush");
|
198
|
+
|
199
|
+
}
|
200
|
+
|
201
|
+
RequestDispatcher rd = request.getRequestDispatcher("/WEB-INF/views/dispatch/index.jsp");
|
202
|
+
|
203
|
+
rd.forward(request, response);
|
204
|
+
|
205
|
+
}
|
206
|
+
|
207
|
+
}
|
208
|
+
|
209
|
+
|
210
|
+
|
211
|
+
```
|
212
|
+
|
213
|
+
_form.jsp
|
214
|
+
|
215
|
+
```JSP
|
216
|
+
|
217
|
+
<p>
|
218
|
+
|
219
|
+
<form method="GET" action = "DispatchCreateServlet.java">
|
220
|
+
|
221
|
+
<label for="task_date">日付</label>
|
222
|
+
|
223
|
+
<br />
|
224
|
+
|
225
|
+
<input type="date" name="task_date" value="<fmt:formatDate value='${Trucks.task_date}' pattern='M月d日' />" />
|
226
|
+
|
227
|
+
(出発地、到着地、時刻などのformのコードなので中略)
|
228
|
+
|
229
|
+
<input type="hidden" name="_token" value="${_token}" />
|
230
|
+
|
231
|
+
<button type="submit">登録</button>
|
232
|
+
|
233
|
+
</form>
|
234
|
+
|
235
|
+
|
236
|
+
|
237
|
+
```
|
238
|
+
|
239
|
+
DispatchCreateServlet.java
|
240
|
+
|
241
|
+
```Java
|
242
|
+
|
243
|
+
|
244
|
+
|
245
|
+
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
246
|
+
|
247
|
+
String _token = (String)request.getParameter("_token");
|
248
|
+
|
249
|
+
if(_token != null && _token.equals(request.getSession().getId())) {
|
250
|
+
|
251
|
+
EntityManager em = DBUtil.createEntityManager();
|
252
|
+
|
253
|
+
|
254
|
+
|
255
|
+
Trucks t = new Trucks();
|
256
|
+
|
257
|
+
|
258
|
+
|
259
|
+
String sa_select = request.getParameter("sa_select");
|
260
|
+
|
261
|
+
String sa_text = request.getParameter("sa_text");
|
262
|
+
|
263
|
+
String stack_area = sa_select + sa_text;
|
264
|
+
|
265
|
+
String wa_select = request.getParameter("wa_select");
|
266
|
+
|
267
|
+
String wa_text = request.getParameter("wa_text");
|
268
|
+
|
269
|
+
String wholesale_area = wa_select + wa_text;
|
270
|
+
|
271
|
+
String office_name = request.getParameter("office_name");
|
272
|
+
|
273
|
+
String wa_time = request.getParameter("wa_time");
|
274
|
+
|
275
|
+
String sa_time = request.getParameter("sa_time");
|
276
|
+
|
277
|
+
String wa_time2 = request.getParameter("wa_time2");
|
278
|
+
|
279
|
+
String sa_time2 = request.getParameter("sa_time2");
|
280
|
+
|
281
|
+
String es_select = request.getParameter("es_select");
|
282
|
+
|
283
|
+
String es_text = request.getParameter("es_text");
|
284
|
+
|
285
|
+
String e_stack_area = es_select +es_text;
|
286
|
+
|
287
|
+
String mw_time = request.getParameter("mw_time");
|
288
|
+
|
289
|
+
String es_time = request.getParameter("es_time");
|
290
|
+
|
291
|
+
String mw_select = request.getParameter("mw_select");
|
292
|
+
|
293
|
+
String mw_text = request.getParameter("mw_text");
|
294
|
+
|
295
|
+
String m_wholesale_area = mw_select + mw_text;
|
296
|
+
|
297
|
+
String sa_select2 = request.getParameter("sa_select2");
|
298
|
+
|
299
|
+
String sa_text2 = request.getParameter("sa_text2");
|
300
|
+
|
301
|
+
String stack_area2 = sa_select2 + sa_text2;
|
302
|
+
|
303
|
+
String wa_select2 = request.getParameter("wa_select2");
|
304
|
+
|
305
|
+
String wa_text2 = request.getParameter("wa_text2");
|
306
|
+
|
307
|
+
String wholesale_area2 = wa_select2 + wa_text2;
|
308
|
+
|
309
|
+
|
310
|
+
|
311
|
+
Date task_date = new Date(System.currentTimeMillis());
|
312
|
+
|
313
|
+
String rd_str = request.getParameter("task_date");
|
314
|
+
|
315
|
+
if(rd_str != null && !rd_str.equals("")){
|
316
|
+
|
317
|
+
task_date = Date.valueOf(request.getParameter("task_date"));
|
318
|
+
|
319
|
+
|
320
|
+
|
321
|
+
}
|
322
|
+
|
323
|
+
t.setTask_date(task_date);
|
324
|
+
|
325
|
+
t.setStack_area(stack_area);
|
326
|
+
|
327
|
+
t.setWholesale_area(wholesale_area);
|
328
|
+
|
329
|
+
t.setOffice_name(office_name);
|
330
|
+
|
331
|
+
t.setWa_time(wa_time);
|
332
|
+
|
333
|
+
t.setSa_time(sa_time);
|
334
|
+
|
335
|
+
t.setWa_time2(wa_time2);
|
336
|
+
|
337
|
+
t.setSa_time2(sa_time2);
|
338
|
+
|
339
|
+
t.setM_wholesale_area(m_wholesale_area);
|
340
|
+
|
341
|
+
t.setE_stack_area(e_stack_area);
|
342
|
+
|
343
|
+
t.setMw_time(mw_time);
|
344
|
+
|
345
|
+
t.setEs_time(es_time);
|
346
|
+
|
347
|
+
t.setStack_area2(stack_area2);
|
348
|
+
|
349
|
+
t.setWholesale_area2(wholesale_area2);
|
350
|
+
|
351
|
+
|
352
|
+
|
353
|
+
List<String> errors = DispatchValidator.validate(t);
|
354
|
+
|
355
|
+
if(errors.size() > 0) {
|
356
|
+
|
357
|
+
em.close();
|
358
|
+
|
359
|
+
|
360
|
+
|
361
|
+
request.setAttribute("errors", errors);
|
362
|
+
|
363
|
+
request.setAttribute("_token", request.getSession().getId());
|
364
|
+
|
365
|
+
request.setAttribute("stack_area",stack_area);
|
366
|
+
|
367
|
+
request.setAttribute("wholesale_area",wholesale_area);
|
368
|
+
|
369
|
+
request.setAttribute("office_name",office_name);
|
370
|
+
|
371
|
+
request.setAttribute("wa_time",wa_time);
|
372
|
+
|
373
|
+
request.setAttribute("sa_time",sa_time);
|
374
|
+
|
375
|
+
request.setAttribute("wa_time2",wa_time2);
|
376
|
+
|
377
|
+
request.setAttribute("sa_time2",sa_time2);
|
378
|
+
|
379
|
+
request.setAttribute("e_stack_area",e_stack_area);
|
380
|
+
|
381
|
+
request.setAttribute("m_wholesale_area",m_wholesale_area);
|
382
|
+
|
383
|
+
request.setAttribute("mw_time",mw_time);
|
384
|
+
|
385
|
+
request.setAttribute("es_time",es_time);
|
386
|
+
|
387
|
+
request.setAttribute("stack_area2",stack_area2);
|
388
|
+
|
389
|
+
request.setAttribute("wholesale_area2",wholesale_area2);
|
390
|
+
|
391
|
+
|
392
|
+
|
393
|
+
RequestDispatcher rd = request.getRequestDispatcher("/WEB-INF/views/dispatch/new.jsp");
|
394
|
+
|
395
|
+
rd.forward(request, response);
|
396
|
+
|
397
|
+
|
398
|
+
|
399
|
+
} else {
|
400
|
+
|
401
|
+
em.getTransaction().begin();
|
402
|
+
|
403
|
+
em.persist(t);
|
404
|
+
|
405
|
+
em.getTransaction().commit();
|
406
|
+
|
407
|
+
em.close();
|
408
|
+
|
409
|
+
request.getSession().setAttribute("flush", "登録が完了しました。");
|
410
|
+
|
411
|
+
|
412
|
+
|
413
|
+
response.sendRedirect(request.getContextPath() + "/dispatch/index");
|
414
|
+
|
415
|
+
}
|
416
|
+
|
417
|
+
|
418
|
+
|
419
|
+
}
|
208
420
|
|
209
421
|
}
|
210
422
|
|
211
|
-
|
212
|
-
|
213
|
-
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
214
|
-
|
215
|
-
EntityManager em = DBUtil.createEntityManager();
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
List<Trucks> trucks = em.createNamedQuery("getAllTrucks",Trucks.class)
|
220
|
-
|
221
|
-
.getResultList();
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
long trucks_count = (long)em.createNamedQuery("getTrucksCount", Long.class)
|
226
|
-
|
227
|
-
.getSingleResult();
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
em.close();
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
request.setAttribute("trucks", trucks);
|
242
|
-
|
243
|
-
request.setAttribute("trucks_count", trucks_count);
|
244
|
-
|
245
|
-
if(request.getSession().getAttribute("flush") != null) {
|
246
|
-
|
247
|
-
request.setAttribute("flush", request.getSession().getAttribute("flush"));
|
248
|
-
|
249
|
-
request.getSession().removeAttribute("flush");
|
250
|
-
|
251
|
-
}
|
252
|
-
|
253
|
-
RequestDispatcher rd = request.getRequestDispatcher("/WEB-INF/views/dispatch/index.jsp");
|
254
|
-
|
255
|
-
rd.forward(request, response);
|
256
|
-
|
257
|
-
}
|
258
|
-
|
259
423
|
}
|
260
424
|
|
261
425
|
|
262
426
|
|
427
|
+
|
428
|
+
|
263
429
|
```
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
```JSP
|
268
|
-
|
269
|
-
<p>
|
270
|
-
|
271
|
-
<form method="GET" action = "DispatchCreateServlet.java">
|
272
|
-
|
273
|
-
<label for="task_date">日付</label>
|
274
|
-
|
275
|
-
<br />
|
276
|
-
|
277
|
-
<input type="date" name="task_date" value="<fmt:formatDate value='${Trucks.task_date}' pattern='M月d日' />" />
|
278
|
-
|
279
|
-
(出発地、到着地、時刻などのformのコードなので中略)
|
280
|
-
|
281
|
-
<input type="hidden" name="_token" value="${_token}" />
|
282
|
-
|
283
|
-
<button type="submit">登録</button>
|
284
|
-
|
285
|
-
</form>
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
```
|
2
追記・修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -14,46 +14,276 @@
|
|
14
14
|
|
15
15
|
期待した結果が得られなかったので、<c:if文の部分のコードを記載しますのでアドバイスを頂きたいです。
|
16
16
|
|
17
|
-
###追記
|
17
|
+
###追記内容
|
18
18
|
|
19
19
|
自分で試した内容について参考にさせて頂いたURL
|
20
20
|
|
21
21
|
http://struts.wasureppoi.com/jstl/02_if.html
|
22
22
|
|
23
|
+
![イメージ説明](b057bb18a0d0865971583a36070749ea.png)
|
24
|
+
|
25
|
+
JSP、以前の内容から色々書き直しているのでコード修正しました。
|
26
|
+
|
23
27
|
### 試した内容
|
24
28
|
|
25
|
-
|
29
|
+
**index.jsp**
|
26
30
|
|
27
31
|
```JSP
|
28
32
|
|
33
|
+
<div class="Truck_table_wrapper">
|
34
|
+
|
35
|
+
<table class="Truck_table">
|
36
|
+
|
37
|
+
<thead>
|
38
|
+
|
39
|
+
<tr>
|
40
|
+
|
41
|
+
<th class="space1" rowspan="2" colspan="4"></th>
|
42
|
+
|
43
|
+
<c:forEach begin="1" end="31" varStatus="stts">
|
44
|
+
|
45
|
+
<th class="date" colspan="4">1月<c:out value="${stts.count}"></c:out>日</th></c:forEach>
|
46
|
+
|
47
|
+
</tr>
|
48
|
+
|
49
|
+
<tr>
|
50
|
+
|
51
|
+
<c:forEach begin="1" end="31">
|
52
|
+
|
53
|
+
<th class="task_type">宵積卸地</th>
|
54
|
+
|
55
|
+
<th class="task_type">積地</th>
|
56
|
+
|
57
|
+
<th class="task_type">卸地</th>
|
58
|
+
|
59
|
+
<th class="task_type">宵積</th>
|
60
|
+
|
61
|
+
</c:forEach>
|
62
|
+
|
63
|
+
</tr>
|
64
|
+
|
65
|
+
</thead>
|
66
|
+
|
67
|
+
<c:if test="${value == null}" var="flg">
|
68
|
+
|
69
|
+
<c:forEach var="truck" items="${trucks}" varStatus="status">
|
70
|
+
|
71
|
+
<tbody>
|
72
|
+
|
73
|
+
<tr>
|
74
|
+
|
75
|
+
<td class="office_name" rowspan="4"><c:out value="${truck.office_name}"></c:out></td>
|
76
|
+
|
77
|
+
<td class ="truck_code" colspan="2" rowspan="4"><c:out value="${truck.truck_code}"></c:out></td>
|
78
|
+
|
79
|
+
<td class ="truck_type" rowspan="4"><c:out value="${truck.truck_type}"></c:out></td>
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
<td class ="time"><c:out value="${truck.mw_time}"></c:out></td>
|
84
|
+
|
85
|
+
<td class ="time"><c:out value="${truck.sa_time}"></c:out></td>
|
86
|
+
|
87
|
+
<td class ="time"><c:out value="${truck.wa_time}"></c:out></td>
|
88
|
+
|
89
|
+
<td class ="time"><c:out value="${truck.es_time}"></c:out></td>
|
90
|
+
|
91
|
+
</tr>
|
92
|
+
|
93
|
+
<c:if test="${flg}">
|
94
|
+
|
95
|
+
<tr>
|
96
|
+
|
97
|
+
<td class ="area" id="1"><c:out value="${truck.m_wholesale_area}"></c:out></td>
|
98
|
+
|
99
|
+
<td class ="area" id="1"><c:out value="${truck.stack_area}"></c:out></td>
|
100
|
+
|
101
|
+
<td class ="area" id="1"><c:out value="${truck.wholesale_area}"></c:out></td>
|
102
|
+
|
103
|
+
<td class ="area" id="1"><c:out value="${truck.e_stack_area}"></c:out></td>
|
104
|
+
|
105
|
+
</tr>
|
106
|
+
|
107
|
+
</c:if>
|
108
|
+
|
109
|
+
<c:if test="${!flg}">
|
110
|
+
|
111
|
+
<tr>
|
112
|
+
|
113
|
+
<td class ="area" id="2"><c:out value="${truck.m_wholesale_area}"></c:out></td>
|
114
|
+
|
115
|
+
<td class ="area" id="2"><c:out value="${truck.stack_area}"></c:out></td>
|
116
|
+
|
117
|
+
<td class ="area" id="2"><c:out value="${truck.wholesale_area}"></c:out></td>
|
118
|
+
|
119
|
+
<td class ="area" id="2"><c:out value="${truck.e_stack_area}"></c:out></td>
|
120
|
+
|
121
|
+
</tr>
|
122
|
+
|
123
|
+
</c:if>
|
124
|
+
|
125
|
+
<tr>
|
126
|
+
|
127
|
+
<td class ="time"></td>
|
128
|
+
|
129
|
+
<td class ="time"><c:out value="${truck.sa_time2}"></c:out></td>
|
130
|
+
|
131
|
+
<td class ="time"><c:out value="${truck.wa_time2}"></c:out></td>
|
132
|
+
|
133
|
+
<td class ="time"></td>
|
134
|
+
|
135
|
+
</tr>
|
136
|
+
|
137
|
+
<tr>
|
138
|
+
|
139
|
+
<td class ="area" id="3">ボタン</td>
|
140
|
+
|
141
|
+
<td class ="area" id="3"><c:out value="${truck.stack_area2}"></c:out></td>
|
142
|
+
|
143
|
+
<td class ="area" id="3"><c:out value="${truck.wholesale_area2}"></c:out></td>
|
144
|
+
|
145
|
+
<td class ="area" id="3">ボタン</td>
|
146
|
+
|
147
|
+
</tr>
|
148
|
+
|
149
|
+
</tbody>
|
150
|
+
|
151
|
+
</c:forEach>
|
152
|
+
|
153
|
+
</c:if>
|
154
|
+
|
155
|
+
</table>
|
156
|
+
|
157
|
+
</div>
|
158
|
+
|
159
|
+
```
|
160
|
+
|
161
|
+
**DispatchIndexServlet.java**
|
162
|
+
|
163
|
+
```Java
|
164
|
+
|
165
|
+
import java.io.IOException;
|
166
|
+
|
167
|
+
import java.util.List;
|
168
|
+
|
169
|
+
|
170
|
+
|
171
|
+
import javax.persistence.EntityManager;
|
172
|
+
|
173
|
+
import javax.servlet.RequestDispatcher;
|
174
|
+
|
175
|
+
import javax.servlet.ServletException;
|
176
|
+
|
177
|
+
import javax.servlet.annotation.WebServlet;
|
178
|
+
|
179
|
+
import javax.servlet.http.HttpServlet;
|
180
|
+
|
181
|
+
import javax.servlet.http.HttpServletRequest;
|
182
|
+
|
183
|
+
import javax.servlet.http.HttpServletResponse;
|
184
|
+
|
185
|
+
|
186
|
+
|
187
|
+
import models.Trucks;
|
188
|
+
|
189
|
+
import utils.DBUtil;
|
190
|
+
|
191
|
+
|
192
|
+
|
193
|
+
|
194
|
+
|
195
|
+
@WebServlet("/dispatch/index")
|
196
|
+
|
197
|
+
public class DispatchIndexServlet extends HttpServlet {
|
198
|
+
|
199
|
+
private static final long serialVersionUID = 1L;
|
200
|
+
|
201
|
+
|
202
|
+
|
203
|
+
|
204
|
+
|
205
|
+
public DispatchIndexServlet() {
|
206
|
+
|
207
|
+
super();
|
208
|
+
|
209
|
+
}
|
210
|
+
|
211
|
+
|
212
|
+
|
213
|
+
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
214
|
+
|
215
|
+
EntityManager em = DBUtil.createEntityManager();
|
216
|
+
|
217
|
+
|
218
|
+
|
219
|
+
List<Trucks> trucks = em.createNamedQuery("getAllTrucks",Trucks.class)
|
220
|
+
|
221
|
+
.getResultList();
|
222
|
+
|
223
|
+
|
224
|
+
|
225
|
+
long trucks_count = (long)em.createNamedQuery("getTrucksCount", Long.class)
|
226
|
+
|
227
|
+
.getSingleResult();
|
228
|
+
|
229
|
+
|
230
|
+
|
231
|
+
em.close();
|
232
|
+
|
233
|
+
|
234
|
+
|
235
|
+
|
236
|
+
|
237
|
+
|
238
|
+
|
239
|
+
|
240
|
+
|
241
|
+
request.setAttribute("trucks", trucks);
|
242
|
+
|
243
|
+
request.setAttribute("trucks_count", trucks_count);
|
244
|
+
|
245
|
+
if(request.getSession().getAttribute("flush") != null) {
|
246
|
+
|
247
|
+
request.setAttribute("flush", request.getSession().getAttribute("flush"));
|
248
|
+
|
249
|
+
request.getSession().removeAttribute("flush");
|
250
|
+
|
251
|
+
}
|
252
|
+
|
253
|
+
RequestDispatcher rd = request.getRequestDispatcher("/WEB-INF/views/dispatch/index.jsp");
|
254
|
+
|
255
|
+
rd.forward(request, response);
|
256
|
+
|
257
|
+
}
|
258
|
+
|
259
|
+
}
|
260
|
+
|
261
|
+
|
262
|
+
|
263
|
+
```
|
264
|
+
|
265
|
+
|
266
|
+
|
267
|
+
```JSP
|
268
|
+
|
269
|
+
<p>
|
270
|
+
|
271
|
+
<form method="GET" action = "DispatchCreateServlet.java">
|
272
|
+
|
273
|
+
<label for="task_date">日付</label>
|
274
|
+
|
275
|
+
<br />
|
276
|
+
|
277
|
+
<input type="date" name="task_date" value="<fmt:formatDate value='${Trucks.task_date}' pattern='M月d日' />" />
|
278
|
+
|
279
|
+
(出発地、到着地、時刻などのformのコードなので中略)
|
280
|
+
|
29
|
-
<input type="hidden" name="_token" value="${_token}" />
|
281
|
+
<input type="hidden" name="_token" value="${_token}" />
|
30
282
|
|
31
283
|
<button type="submit">登録</button>
|
32
284
|
|
33
285
|
</form>
|
34
286
|
|
35
|
-
|
287
|
+
|
36
|
-
|
37
|
-
%>
|
38
|
-
|
39
|
-
<c:if test="${task_date == date }" var="flg"/>
|
40
|
-
|
41
|
-
<c:if test="${flg}">
|
42
|
-
|
43
|
-
</c:if>
|
44
|
-
|
45
|
-
<c:if test="${!flg}">
|
46
|
-
|
47
|
-
<c:redirect url="/dispatch/index">
|
48
|
-
|
49
|
-
<div id="flush_error">
|
50
|
-
|
51
|
-
<br />
|
52
|
-
|
53
|
-
</div>
|
54
|
-
|
55
|
-
</c:redirect>
|
56
|
-
|
57
|
-
</c:if>
|
58
288
|
|
59
289
|
```
|
1
追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -14,7 +14,13 @@
|
|
14
14
|
|
15
15
|
期待した結果が得られなかったので、<c:if文の部分のコードを記載しますのでアドバイスを頂きたいです。
|
16
16
|
|
17
|
+
###追記
|
18
|
+
|
19
|
+
自分で試した内容について参考にさせて頂いたURL
|
20
|
+
|
21
|
+
http://struts.wasureppoi.com/jstl/02_if.html
|
22
|
+
|
17
|
-
###
|
23
|
+
### 試した内容
|
18
24
|
|
19
25
|
|
20
26
|
|