質問編集履歴

3

情報の追加

2021/01/19 09:18

投稿

K_3578
K_3578

スコア1282

test CHANGED
File without changes
test CHANGED
@@ -302,6 +302,142 @@
302
302
 
303
303
  ```
304
304
 
305
+ ```
306
+
307
+ Hibernate:
308
+
309
+
310
+
311
+ create table trucks (
312
+
313
+ id integer not null auto_increment,
314
+
315
+ office_name varchar(255),
316
+
317
+ sa_time varchar(255),
318
+
319
+ stack_area varchar(255),
320
+
321
+ task_date date,
322
+
323
+ task_time time,
324
+
325
+ task_type varchar(255),
326
+
327
+ truck_code varchar(255),
328
+
329
+ truck_type varchar(255),
330
+
331
+ wa_time varchar(255),
332
+
333
+ wholesale_area varchar(255),
334
+
335
+ primary key (id)
336
+
337
+ ) engine=MyISAM
338
+
339
+ --------------------------------
340
+
341
+ Hibernate:
342
+
343
+ select
344
+
345
+ trucks0_.id as id1_1_,
346
+
347
+ trucks0_.office_name as office_n2_1_,
348
+
349
+ trucks0_.sa_time as sa_time3_1_,
350
+
351
+ trucks0_.stack_area as stack_ar4_1_,
352
+
353
+ trucks0_.task_date as task_dat5_1_,
354
+
355
+ trucks0_.task_time as task_tim6_1_,
356
+
357
+ trucks0_.task_type as task_typ7_1_,
358
+
359
+ trucks0_.truck_code as truck_co8_1_,
360
+
361
+ trucks0_.truck_type as truck_ty9_1_,
362
+
363
+ trucks0_.wa_time as wa_time10_1_,
364
+
365
+ trucks0_.wholesale_area as wholesa11_1_
366
+
367
+ from
368
+
369
+ trucks trucks0_
370
+
371
+ Hibernate:
372
+
373
+ select
374
+
375
+ count(trucks0_.id) as col_0_0_
376
+
377
+ from
378
+
379
+ trucks trucks0_
380
+
381
+ Hibernate:
382
+
383
+ insert
384
+
385
+ into
386
+
387
+ trucks
388
+
389
+ (office_name, sa_time, stack_area, task_date, task_time, task_type, truck_code, truck_type, wa_time, wholesale_area)
390
+
391
+ values
392
+
393
+ (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
394
+
395
+ Hibernate:
396
+
397
+ select
398
+
399
+ trucks0_.id as id1_1_,
400
+
401
+ trucks0_.office_name as office_n2_1_,
402
+
403
+ trucks0_.sa_time as sa_time3_1_,
404
+
405
+ trucks0_.stack_area as stack_ar4_1_,
406
+
407
+ trucks0_.task_date as task_dat5_1_,
408
+
409
+ trucks0_.task_time as task_tim6_1_,
410
+
411
+ trucks0_.task_type as task_typ7_1_,
412
+
413
+ trucks0_.truck_code as truck_co8_1_,
414
+
415
+ trucks0_.truck_type as truck_ty9_1_,
416
+
417
+ trucks0_.wa_time as wa_time10_1_,
418
+
419
+ trucks0_.wholesale_area as wholesa11_1_
420
+
421
+ from
422
+
423
+ trucks trucks0_
424
+
425
+ Hibernate:
426
+
427
+ select
428
+
429
+ count(trucks0_.id) as col_0_0_
430
+
431
+ from
432
+
433
+ trucks trucks0_
434
+
435
+
436
+
437
+
438
+
439
+ ```
440
+
305
441
  ##エラーメッセージ
306
442
 
307
443
  ![イメージ説明](e77248d610e85459d850565768c5a752.png)

2

情報の追加

2021/01/19 09:18

投稿

K_3578
K_3578

スコア1282

test CHANGED
File without changes
test CHANGED
@@ -14,6 +14,8 @@
14
14
 
15
15
  ##ソースコード
16
16
 
17
+ ![イメージ説明](87764bfb67cfc645e0a6e57968a3c90e.png)
18
+
17
19
  ```JSP
18
20
 
19
21
  <table class="Truck_table">
@@ -304,8 +306,12 @@
304
306
 
305
307
  ![イメージ説明](e77248d610e85459d850565768c5a752.png)
306
308
 
307
-
309
+ ##実際の画面
310
+
311
+ ![イメージ説明](f2522c71a2276355791a6159a7eadb35.jpeg)
308
312
 
309
313
  ### 補足情報(FW/ツールのバージョンなど)
310
314
 
315
+
316
+
311
317
  Eclipse4.6Neon使用

1

追記

2021/01/19 08:41

投稿

K_3578
K_3578

スコア1282

test CHANGED
File without changes
test CHANGED
@@ -190,6 +190,116 @@
190
190
 
191
191
  ```
192
192
 
193
+
194
+
195
+ ```
196
+
197
+ package controllers.dispatch;
198
+
199
+
200
+
201
+
202
+
203
+ import java.io.IOException;
204
+
205
+ import java.util.List;
206
+
207
+
208
+
209
+ import javax.persistence.EntityManager;
210
+
211
+ import javax.servlet.RequestDispatcher;
212
+
213
+ import javax.servlet.ServletException;
214
+
215
+ import javax.servlet.annotation.WebServlet;
216
+
217
+ import javax.servlet.http.HttpServlet;
218
+
219
+ import javax.servlet.http.HttpServletRequest;
220
+
221
+ import javax.servlet.http.HttpServletResponse;
222
+
223
+
224
+
225
+ import models.Trucks;
226
+
227
+ import utils.DBUtil;
228
+
229
+
230
+
231
+
232
+
233
+ @WebServlet("/dispatch/index")
234
+
235
+ public class DispatchIndexServlet extends HttpServlet {
236
+
237
+ private static final long serialVersionUID = 1L;
238
+
239
+
240
+
241
+
242
+
243
+ public DispatchIndexServlet() {
244
+
245
+ super();
246
+
247
+ }
248
+
249
+
250
+
251
+ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
252
+
253
+ EntityManager em = DBUtil.createEntityManager();
254
+
255
+
256
+
257
+ List<Trucks> trucks = em.createNamedQuery("getAllTrucks",Trucks.class)
258
+
259
+ .getResultList();
260
+
261
+
262
+
263
+ long trucks_count = (long)em.createNamedQuery("getTrucksCount", Long.class)
264
+
265
+ .getSingleResult();
266
+
267
+
268
+
269
+ em.close();
270
+
271
+
272
+
273
+
274
+
275
+
276
+
277
+
278
+
279
+ request.setAttribute("trucks", trucks);
280
+
281
+ request.setAttribute("trucks_count", trucks_count);
282
+
283
+ if(request.getSession().getAttribute("flush") != null) {
284
+
285
+ request.setAttribute("flush", request.getSession().getAttribute("flush"));
286
+
287
+ request.getSession().removeAttribute("flush");
288
+
289
+ }
290
+
291
+ RequestDispatcher rd = request.getRequestDispatcher("/WEB-INF/views/dispatch/index.jsp");
292
+
293
+ rd.forward(request, response);
294
+
295
+ }
296
+
297
+ }
298
+
299
+
300
+
301
+ ```
302
+
193
303
  ##エラーメッセージ
194
304
 
195
305
  ![イメージ説明](e77248d610e85459d850565768c5a752.png)