質問編集履歴

3

タグの数を調整

2019/11/18 09:21

投稿

javas
javas

スコア5

test CHANGED
File without changes
test CHANGED
File without changes

2

タグ編集

2019/11/18 09:21

投稿

javas
javas

スコア5

test CHANGED
File without changes
test CHANGED
@@ -342,179 +342,185 @@
342
342
 
343
343
  20.}
344
344
 
345
- 21.
346
-
347
- 22.package servlet;
348
-
349
- 23.
350
-
351
- 24.import java.io.IOException;
352
-
353
- 25.
354
-
355
- 26.import javax.servlet.RequestDispatcher;
356
-
357
- 27.import javax.servlet.ServletException;
358
-
359
- 28.import javax.servlet.annotation.WebServlet;
360
-
361
- 29.import javax.servlet.http.HttpServlet;
362
-
363
- 30.import javax.servlet.http.HttpServletRequest;
364
-
365
- 31.import javax.servlet.http.HttpServletResponse;
366
-
367
- 32.import javax.servlet.http.HttpSession;
368
-
369
- 33.
370
-
371
- 34.import model.RegisterUserLogic;
372
-
373
- 35.import model.User;
374
-
375
- 36./**
376
-
377
- 37. * Servlet implementation class RegisterUser
378
-
379
- 38. */
380
-
381
- 40.@WebServlet("/RegisterUser")
382
-
383
- 41.public class RegisterUser extends HttpServlet {
384
-
385
- 42. private static final long serialVersionUID = 1L;
345
+
346
+
347
+ 1.package servlet;
348
+
349
+ 2.
350
+
351
+ 3.import java.io.IOException;
352
+
353
+ 4.
354
+
355
+ 5.import javax.servlet.RequestDispatcher;
356
+
357
+ 6.import javax.servlet.ServletException;
358
+
359
+ 7.import javax.servlet.annotation.WebServlet;
360
+
361
+ 8.import javax.servlet.http.HttpServlet;
362
+
363
+ 9.import javax.servlet.http.HttpServletRequest;
364
+
365
+ 10.import javax.servlet.http.HttpServletResponse;
366
+
367
+ 11.import javax.servlet.http.HttpSession;
368
+
369
+ 12.
370
+
371
+ 13.import model.RegisterUserLogic;
372
+
373
+ 14.
374
+
375
+ 15.import model.User;
376
+
377
+ 16./**
378
+
379
+ 17. * Servlet implementation class RegisterUser
380
+
381
+ 18. */
382
+
383
+ 19.@WebServlet("/RegisterUser")
384
+
385
+ 20.public class RegisterUser extends HttpServlet {
386
+
387
+ 21. private static final long serialVersionUID = 1L;
388
+
389
+ 22.
390
+
391
+ 23. /**
392
+
393
+ 24. * @see HttpServlet#HttpServlet()
394
+
395
+ 25. */
396
+
397
+ 26. public RegisterUser() {
398
+
399
+ 27. super();
400
+
401
+ 28. // TODO Auto-generated constructor stub
402
+
403
+ 29. }
404
+
405
+ 30.
406
+
407
+ 31. /**
408
+
409
+ 32. * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
410
+
411
+ 33. */
412
+
413
+ 34. protected void doGet(HttpServletRequest request, 57.HttpServletResponse response) 35.throws ServletException, IOException {
414
+
415
+ 36.// // TODO Auto-generated method stub
416
+
417
+ 37.// response.getWriter().append("Served at: 60.").append(request.getContextPath());
418
+
419
+ 38.
420
+
421
+ 39.
422
+
423
+ 40. String forwardPath = null;
424
+
425
+ 41.
426
+
427
+ 42. String action = request.getParameter("action");
386
428
 
387
429
  43.
388
430
 
389
- 44. /**
431
+ 44.
390
-
391
- 45. * @see HttpServlet#HttpServlet()
432
+
392
-
393
- 46. */
394
-
395
- 47. public RegisterUser() {
433
+ 45. if(action == null){
434
+
396
-
435
+ 46.
436
+
437
+ 47.
438
+
439
+ 49. forwardPath = "/WEB-INF/jsp/Form.jsp";
440
+
397
- 48. super();
441
+ 50. }
398
-
399
- 49. // TODO Auto-generated constructor stub
400
-
401
- 50. }
402
442
 
403
443
  51.
404
444
 
405
- 52. /**
445
+ 52. else if(action.equals("done")){
446
+
406
-
447
+ 53.
448
+
449
+ 54. HttpSession session = request.getSession();
450
+
407
- 53. * @see HttpServlet#doGet(HttpServletRequest request, 54.HttpServletResponse response)
451
+ 55. User to = (User)session.getAttribute("registerUser");
408
-
452
+
409
- 55. */
453
+ 56.
410
-
411
- 56. protected void doGet(HttpServletRequest request, 57.HttpServletResponse response) throws ServletException, IOException {
454
+
412
-
413
- 58.// // TODO Auto-generated method stub
455
+ 57. System.out.println( "registerUser"+ to);
456
+
414
-
457
+ 58.
458
+
415
- 59.// response.getWriter().append("Served at: 60.").append(request.getContextPath());
459
+ 59. RegisterUserLogic logic = new RegisterUserLogic();
460
+
461
+ 60. logic.exute(to);
416
462
 
417
463
  61.
418
464
 
419
465
  62.
420
466
 
421
- 63. String forwardPath = null;
467
+ 63. session.removeAttribute("registerUser");
422
468
 
423
469
  64.
424
470
 
425
- 65. String action = request.getParameter("action");
426
-
427
- 66.
471
+ 65.
472
+
473
+ 66. forwardPath = "/WEB-INF/jsp/Done.jsp";
428
474
 
429
475
  67.
430
476
 
431
- 68. if(action == null){
477
+ 68. }
432
478
 
433
479
  69.
434
480
 
435
481
  70.
436
482
 
437
- 71. forwardPath = "/WEB-INF/jsp/Form.jsp";
438
-
439
- 72. }
440
-
441
- 73.
442
-
443
- 74. else if(action.equals("done")){
444
-
445
- 75.
446
-
447
- 76. HttpSession session = request.getSession();
448
-
449
- 77. User to = (User)session.getAttribute("registerUser");
450
-
451
- 78.
452
-
453
- 79. System.out.println( "registerUser"+ to);
454
-
455
- 80.
456
-
457
- 81. RegisterUserLogic logic = new RegisterUserLogic();
458
-
459
- 82. logic.exute(to);
460
-
461
- 83.
462
-
463
- 84.
464
-
465
- 85. session.removeAttribute("registerUser");
466
-
467
- 86.
468
-
469
- 87.
470
-
471
- 88. forwardPath = "/WEB-INF/jsp/Done.jsp";
472
-
473
- 89.
474
-
475
- 90. }
476
-
477
- 91.
478
-
479
- 92.
480
-
481
- 93. RequestDispatcher dispatcher = 94.request.getRequestDispatcher(forwardPath);
482
-
483
- 95. dispatcher.forward(request, response);
484
-
485
- 96. }
486
-
487
- 97.
488
-
489
- 98. /**
490
-
491
- 99. * @see HttpServlet#doPost(HttpServletRequest request, 100.HttpServletResponse response)
492
-
493
- 101. */
494
-
495
- 102. protected void doPost(HttpServletRequest request, 103.HttpServletResponse response) throws ServletException, IOException 104.{
496
-
497
- 105.//
498
-
499
- 106. request.setCharacterEncoding("UTF-8");
500
-
501
- 107. String nao=request.getParameter("created_on");
502
-
503
- 108. User to = new User(nao);
504
-
505
- 109. HttpSession session = request.getSession();
506
-
507
- 110. session.setAttribute("registerUser", to);
508
-
509
- 111.
510
-
511
- 112. RequestDispatcher dispatcher = 113.request.getRequestDispatcher("/WEB-INF/jsp/Confirm.jsp");
512
-
513
- 114. dispatcher.forward(request, response);
514
-
515
- 115. }
516
-
517
- 116.}
483
+ 71. RequestDispatcher dispatcher = 94.request.getRequestDispatcher(forwardPath);
484
+
485
+ 72. dispatcher.forward(request, response);
486
+
487
+ 73. }
488
+
489
+ 74.
490
+
491
+ 75. /**
492
+
493
+ 76. * @see HttpServlet#doPost(HttpServletRequest request,HttpServletResponse response)
494
+
495
+ 77. */
496
+
497
+ 78. protected void doPost(HttpServletRequest request, HttpServletResponse response)
498
+
499
+ throws ServletException, IOException {
500
+
501
+ 79.//
502
+
503
+ 80. request.setCharacterEncoding("UTF-8");
504
+
505
+ 81. String nao=request.getParameter("created_on");
506
+
507
+ 82. User to = new User(nao);
508
+
509
+ 83. HttpSession session = request.getSession();
510
+
511
+ 84. session.setAttribute("registerUser", to);
512
+
513
+ 85.
514
+
515
+ 86. RequestDispatcher dispatcher = request.getRequestDispatcher("/WEB-
516
+
517
+ INF/jsp/Confirm.jsp");
518
+
519
+ 87. dispatcher.forward(request, response);
520
+
521
+ 88. }
522
+
523
+ 89.}
518
524
 
519
525
 
520
526
 

1

タグの変更、コードマークダウン

2019/11/11 07:04

投稿

javas
javas

スコア5

test CHANGED
File without changes
test CHANGED
@@ -114,407 +114,407 @@
114
114
 
115
115
  ```
116
116
 
117
- package model;
118
-
119
- import java.io.Serializable;
120
-
121
- import java.text.DateFormat;
122
-
123
- import java.text.SimpleDateFormat;
124
-
125
- import java.util.Date;
126
-
127
- public class User implements Serializable {
128
-
129
-
130
-
131
-
132
-
133
- private String nao;
134
-
135
- public User() {}
136
-
137
- public User(String nao){
138
-
139
-
140
-
141
- this.nao = nao;
142
-
143
-
144
-
145
-
146
-
147
- }
148
-
149
- public String getToday() {
150
-
151
- DateFormat to= new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
152
-
153
- Date today = new Date();
154
-
155
- String nao= to.format(today);
156
-
157
- return nao;
158
-
159
- }
160
-
161
- }
162
-
163
-
164
-
165
-
166
-
167
- package dao;
168
-
169
-
170
-
171
- import java.sql.Connection;
172
-
173
- import java.sql.PreparedStatement;
174
-
175
- import java.sql.SQLException;
176
-
177
- import java.sql.Statement;
178
-
179
-
180
-
181
- import model.User;
182
-
183
- public class MemberDao {
184
-
185
-
186
-
187
- private Connection con = null;
188
-
189
- private Statement stmt =null;
190
-
191
- private ConnectionManager cm;
192
-
193
-
194
-
195
- private void getConnection() throws DAOException{
196
-
197
- if ( this.con != null ){ return; }
198
-
199
- cm = ConnectionManager.getInstance();
200
-
201
- con = cm.getConnection();
202
-
203
- }
204
-
205
-
206
-
207
-
208
-
209
- private void createStmt() throws DAOException{
210
-
211
- if ( this.stmt != null){ return; }
212
-
213
- try {
214
-
215
-
216
-
217
- stmt =con.createStatement();
218
-
219
- } catch (SQLException e) {
220
-
221
- throw new DAOException("[createStmt]異常", e);
222
-
223
- }
224
-
225
- }
226
-
227
-
228
-
229
- public int insertMember(User user) throws DAOException {
230
-
231
- getConnection();
232
-
233
- int count=0;
234
-
235
-
236
-
237
- String sql = "INSERT INTO documents (created_on) VALUE (?)";
238
-
239
- String nao =user.getToday();
240
-
241
-
242
-
243
- try(PreparedStatement pstmt = con.prepareStatement(sql)) {
244
-
245
- pstmt.setString(1, nao);
246
-
247
- count=pstmt.executeUpdate();
248
-
249
- }catch(SQLException e) {
250
-
251
- throw new DAOException("[UserDAO#insertMember]異常", e);
252
-
253
- } finally {
254
-
255
- close();
256
-
257
- }
258
-
259
- return count;
260
-
261
- }
262
-
263
-
264
-
265
-
266
-
267
- public String setToday(String nao) {
268
-
269
- // TODO 自動生成されたメソッド・スタブ
270
-
271
- return null;
272
-
273
- }
274
-
275
-
276
-
277
-
278
-
279
- private void close() throws DAOException {
280
-
281
- try {
282
-
283
- if (stmt != null) { stmt.close(); }
284
-
285
- } catch (SQLException e) {
286
-
287
- throw new DAOException("[closeStatement]異常", e);
288
-
289
- } finally {
290
-
291
- this.stmt = null;
292
-
293
- this.cm = null;
294
-
295
- }
296
-
297
- }
298
-
299
- }
300
-
301
-
302
-
303
-
304
-
305
- package model;
306
-
307
-
308
-
309
- import dao.DAOException;
310
-
311
- import dao.MemberDao;
312
-
313
- public class RegisterUserLogic {
314
-
315
- MemberDao memberDao = new MemberDao();
316
-
317
- public boolean exute(User user){
318
-
319
- boolean registCheck = false;
320
-
321
- //登録処理
322
-
323
- try {
324
-
325
- memberDao.insertMember(user);
326
-
327
-
328
-
329
- registCheck = true;
330
-
331
- } catch (DAOException e) {
332
-
333
- // TODO
334
-
335
- e.printStackTrace();
336
-
337
- }
338
-
339
- return registCheck;
340
-
341
- }
342
-
343
- }
344
-
345
-
346
-
347
- package servlet;
348
-
349
-
350
-
351
- import java.io.IOException;
352
-
353
-
354
-
355
- import javax.servlet.RequestDispatcher;
356
-
357
- import javax.servlet.ServletException;
358
-
359
- import javax.servlet.annotation.WebServlet;
360
-
361
- import javax.servlet.http.HttpServlet;
362
-
363
- import javax.servlet.http.HttpServletRequest;
364
-
365
- import javax.servlet.http.HttpServletResponse;
366
-
367
- import javax.servlet.http.HttpSession;
368
-
369
-
370
-
371
- import model.RegisterUserLogic;
372
-
373
- import model.User;
374
-
375
- /**
376
-
377
- * Servlet implementation class RegisterUser
378
-
379
- */
380
-
381
- @WebServlet("/RegisterUser")
382
-
383
- public class RegisterUser extends HttpServlet {
384
-
385
- private static final long serialVersionUID = 1L;
386
-
387
-
388
-
389
- /**
390
-
391
- * @see HttpServlet#HttpServlet()
392
-
393
- */
394
-
395
- public RegisterUser() {
396
-
397
- super();
398
-
399
- // TODO Auto-generated constructor stub
400
-
401
- }
402
-
403
-
404
-
405
- /**
406
-
407
- * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
408
-
409
- */
410
-
411
- protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
412
-
413
- // // TODO Auto-generated method stub
414
-
415
- // response.getWriter().append("Served at: ").append(request.getContextPath());
416
-
417
-
418
-
419
-
420
-
421
- String forwardPath = null;
422
-
423
-
424
-
425
- String action = request.getParameter("action");
426
-
427
-
428
-
429
-
430
-
431
- if(action == null){
432
-
433
-
434
-
435
-
436
-
437
- forwardPath = "/WEB-INF/jsp/Form.jsp";
438
-
439
- }
440
-
441
-
442
-
443
- else if(action.equals("done")){
444
-
445
-
446
-
447
- HttpSession session = request.getSession();
448
-
449
- User to = (User)session.getAttribute("registerUser");
450
-
451
-
452
-
453
- System.out.println( "registerUser"+ to);
454
-
455
-
456
-
457
- RegisterUserLogic logic = new RegisterUserLogic();
458
-
459
- logic.exute(to);
460
-
461
-
462
-
463
-
464
-
465
- session.removeAttribute("registerUser");
466
-
467
-
468
-
469
-
470
-
471
- forwardPath = "/WEB-INF/jsp/Done.jsp";
472
-
473
-
474
-
475
- }
476
-
477
-
478
-
479
-
480
-
481
- RequestDispatcher dispatcher = request.getRequestDispatcher(forwardPath);
482
-
483
- dispatcher.forward(request, response);
484
-
485
- }
486
-
487
-
488
-
489
- /**
490
-
491
- * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
492
-
493
- */
494
-
495
- protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
496
-
497
- //
498
-
499
- request.setCharacterEncoding("UTF-8");
500
-
501
- String nao=request.getParameter("created_on");
502
-
503
- User to = new User(nao);
504
-
505
- HttpSession session = request.getSession();
506
-
507
- session.setAttribute("registerUser", to);
508
-
509
-
510
-
511
- RequestDispatcher dispatcher = request.getRequestDispatcher("/WEB-INF/jsp/Confirm.jsp");
512
-
513
- dispatcher.forward(request, response);
514
-
515
- }
516
-
517
- }
117
+ 1.package model;
118
+
119
+ 2.import java.io.Serializable;
120
+
121
+ 3.import java.text.DateFormat;
122
+
123
+ 4.import java.text.SimpleDateFormat;
124
+
125
+ 5.import java.util.Date;
126
+
127
+ 6.public class User implements Serializable {
128
+
129
+ 7.
130
+
131
+ 8.
132
+
133
+ 9. private String nao;
134
+
135
+ 10. public User() {}
136
+
137
+ 11. public User(String nao){
138
+
139
+ 12.
140
+
141
+ 13. this.nao = nao;
142
+
143
+ 14.
144
+
145
+ 15.
146
+
147
+ 16. }
148
+
149
+ 17. public String getToday() {
150
+
151
+ 18. DateFormat to= new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
152
+
153
+ 19. Date today = new Date();
154
+
155
+ 20. String nao= to.format(today);
156
+
157
+ 21. return nao;
158
+
159
+ 22. }
160
+
161
+ 23.}
162
+
163
+
164
+
165
+
166
+
167
+ 1.package dao;
168
+
169
+ 2.
170
+
171
+ 3.import java.sql.Connection;
172
+
173
+ 4.import java.sql.PreparedStatement;
174
+
175
+ 5.import java.sql.SQLException;
176
+
177
+ 6.import java.sql.Statement;
178
+
179
+ 7.
180
+
181
+ 8.import model.User;
182
+
183
+ 9.public class MemberDao {
184
+
185
+ 10.
186
+
187
+ 11. private Connection con = null;
188
+
189
+ 12. private Statement stmt =null;
190
+
191
+ 13. private ConnectionManager cm;
192
+
193
+ 14.
194
+
195
+ 15. private void getConnection() throws DAOException{
196
+
197
+ 16. if ( this.con != null ){ return; }
198
+
199
+ 17. cm = ConnectionManager.getInstance();
200
+
201
+ 18. con = cm.getConnection();
202
+
203
+ 19. }
204
+
205
+ 20.
206
+
207
+ 21.
208
+
209
+ 22. private void createStmt() throws DAOException{
210
+
211
+ 23. if ( this.stmt != null){ return; }
212
+
213
+ 24. try {
214
+
215
+ 25.
216
+
217
+ 26. stmt =con.createStatement();
218
+
219
+ 27. } catch (SQLException e) {
220
+
221
+ 28. throw new DAOException("[createStmt]異常", e);
222
+
223
+ 29. }
224
+
225
+ 30. }
226
+
227
+ 31.
228
+
229
+ 32. public int insertMember(User user) throws DAOException {
230
+
231
+ 33. getConnection();
232
+
233
+ 34. int count=0;
234
+
235
+ 35.
236
+
237
+ 36 String sql = "INSERT INTO documents (created_on) VALUE (?)";
238
+
239
+ 37. String nao =user.getToday();
240
+
241
+ 38.
242
+
243
+ 39. try(PreparedStatement pstmt = con.prepareStatement(sql)) {
244
+
245
+ 40. pstmt.setString(1, nao);
246
+
247
+ 41. count=pstmt.executeUpdate();
248
+
249
+ 42. }catch(SQLException e) {
250
+
251
+ 43. throw new DAOException("[UserDAO#insertMember]異常", e);
252
+
253
+ 44. } finally {
254
+
255
+ 45. close();
256
+
257
+ 46. }
258
+
259
+ 47. return count;
260
+
261
+ 48. }
262
+
263
+ 49.
264
+
265
+ 50.
266
+
267
+ 51. public String setToday(String nao) {
268
+
269
+ 52. // TODO 自動生成されたメソッド・スタブ
270
+
271
+ 53. return null;
272
+
273
+ 54. }
274
+
275
+ 55.
276
+
277
+ 56.
278
+
279
+ 57. private void close() throws DAOException {
280
+
281
+ 58. try {
282
+
283
+ 59. if (stmt != null) { stmt.close(); }
284
+
285
+ 60. } catch (SQLException e) {
286
+
287
+ 61. throw new DAOException("[closeStatement]異常", e);
288
+
289
+ 62. } finally {
290
+
291
+ 63. this.stmt = null;
292
+
293
+ 64. this.cm = null;
294
+
295
+ 65. }
296
+
297
+ 66. }
298
+
299
+ 67.}
300
+
301
+
302
+
303
+
304
+
305
+ 1.package model;
306
+
307
+ 2.
308
+
309
+ 3.import dao.DAOException;
310
+
311
+ 4.import dao.MemberDao;
312
+
313
+ 5.public class RegisterUserLogic {
314
+
315
+ 6. MemberDao memberDao = new MemberDao();
316
+
317
+ 7. public boolean exute(User user){
318
+
319
+ 8. boolean registCheck = false;
320
+
321
+ 9. //登録処理
322
+
323
+ 10. try {
324
+
325
+ 11. memberDao.insertMember(user);
326
+
327
+ 12.
328
+
329
+ 13. registCheck = true;
330
+
331
+ 14. } catch (DAOException e) {
332
+
333
+ 15. // TODO
334
+
335
+ 16. e.printStackTrace();
336
+
337
+ 17. }
338
+
339
+ 18. return registCheck;
340
+
341
+ 19. }
342
+
343
+ 20.}
344
+
345
+ 21.
346
+
347
+ 22.package servlet;
348
+
349
+ 23.
350
+
351
+ 24.import java.io.IOException;
352
+
353
+ 25.
354
+
355
+ 26.import javax.servlet.RequestDispatcher;
356
+
357
+ 27.import javax.servlet.ServletException;
358
+
359
+ 28.import javax.servlet.annotation.WebServlet;
360
+
361
+ 29.import javax.servlet.http.HttpServlet;
362
+
363
+ 30.import javax.servlet.http.HttpServletRequest;
364
+
365
+ 31.import javax.servlet.http.HttpServletResponse;
366
+
367
+ 32.import javax.servlet.http.HttpSession;
368
+
369
+ 33.
370
+
371
+ 34.import model.RegisterUserLogic;
372
+
373
+ 35.import model.User;
374
+
375
+ 36./**
376
+
377
+ 37. * Servlet implementation class RegisterUser
378
+
379
+ 38. */
380
+
381
+ 40.@WebServlet("/RegisterUser")
382
+
383
+ 41.public class RegisterUser extends HttpServlet {
384
+
385
+ 42. private static final long serialVersionUID = 1L;
386
+
387
+ 43.
388
+
389
+ 44. /**
390
+
391
+ 45. * @see HttpServlet#HttpServlet()
392
+
393
+ 46. */
394
+
395
+ 47. public RegisterUser() {
396
+
397
+ 48. super();
398
+
399
+ 49. // TODO Auto-generated constructor stub
400
+
401
+ 50. }
402
+
403
+ 51.
404
+
405
+ 52. /**
406
+
407
+ 53. * @see HttpServlet#doGet(HttpServletRequest request, 54.HttpServletResponse response)
408
+
409
+ 55. */
410
+
411
+ 56. protected void doGet(HttpServletRequest request, 57.HttpServletResponse response) throws ServletException, IOException {
412
+
413
+ 58.// // TODO Auto-generated method stub
414
+
415
+ 59.// response.getWriter().append("Served at: 60.").append(request.getContextPath());
416
+
417
+ 61.
418
+
419
+ 62.
420
+
421
+ 63. String forwardPath = null;
422
+
423
+ 64.
424
+
425
+ 65. String action = request.getParameter("action");
426
+
427
+ 66.
428
+
429
+ 67.
430
+
431
+ 68. if(action == null){
432
+
433
+ 69.
434
+
435
+ 70.
436
+
437
+ 71. forwardPath = "/WEB-INF/jsp/Form.jsp";
438
+
439
+ 72. }
440
+
441
+ 73.
442
+
443
+ 74. else if(action.equals("done")){
444
+
445
+ 75.
446
+
447
+ 76. HttpSession session = request.getSession();
448
+
449
+ 77. User to = (User)session.getAttribute("registerUser");
450
+
451
+ 78.
452
+
453
+ 79. System.out.println( "registerUser"+ to);
454
+
455
+ 80.
456
+
457
+ 81. RegisterUserLogic logic = new RegisterUserLogic();
458
+
459
+ 82. logic.exute(to);
460
+
461
+ 83.
462
+
463
+ 84.
464
+
465
+ 85. session.removeAttribute("registerUser");
466
+
467
+ 86.
468
+
469
+ 87.
470
+
471
+ 88. forwardPath = "/WEB-INF/jsp/Done.jsp";
472
+
473
+ 89.
474
+
475
+ 90. }
476
+
477
+ 91.
478
+
479
+ 92.
480
+
481
+ 93. RequestDispatcher dispatcher = 94.request.getRequestDispatcher(forwardPath);
482
+
483
+ 95. dispatcher.forward(request, response);
484
+
485
+ 96. }
486
+
487
+ 97.
488
+
489
+ 98. /**
490
+
491
+ 99. * @see HttpServlet#doPost(HttpServletRequest request, 100.HttpServletResponse response)
492
+
493
+ 101. */
494
+
495
+ 102. protected void doPost(HttpServletRequest request, 103.HttpServletResponse response) throws ServletException, IOException 104.{
496
+
497
+ 105.//
498
+
499
+ 106. request.setCharacterEncoding("UTF-8");
500
+
501
+ 107. String nao=request.getParameter("created_on");
502
+
503
+ 108. User to = new User(nao);
504
+
505
+ 109. HttpSession session = request.getSession();
506
+
507
+ 110. session.setAttribute("registerUser", to);
508
+
509
+ 111.
510
+
511
+ 112. RequestDispatcher dispatcher = 113.request.getRequestDispatcher("/WEB-INF/jsp/Confirm.jsp");
512
+
513
+ 114. dispatcher.forward(request, response);
514
+
515
+ 115. }
516
+
517
+ 116.}
518
518
 
519
519
 
520
520