質問編集履歴

1

誤字

2020/06/29 11:01

投稿

ypk
ypk

スコア80

test CHANGED
File without changes
test CHANGED
@@ -250,6 +250,280 @@
250
250
 
251
251
 
252
252
 
253
+ ```jsp
254
+
255
+ <%@ page language="java" contentType="text/html; charset=UTF-8"
256
+
257
+ pageEncoding="UTF-8"%>
258
+
259
+ <%@ page import="exam.LoggerTester" %>
260
+
261
+ <% request.setCharacterEncoding("UTF-8"); %>
262
+
263
+ <% String loginErrorMessage = (String)request.getAttribute("loginErrorMessage"); %>
264
+
265
+ <!DOCTYPE html>
266
+
267
+ <html>
268
+
269
+ <head>
270
+
271
+ <meta charset="UTF-8">
272
+
273
+ <title>書籍管理システム-<ログイン></title>
274
+
275
+ <link rel="stylesheet" href="header.css">
276
+
277
+ </head>
278
+
279
+
280
+
281
+ <div class="container">
282
+
283
+ <header>
284
+
285
+
286
+
287
+ <div class="header_logo_font">
288
+
289
+ <p>書籍管理システムログイン</p>
290
+
291
+ </div>
292
+
293
+ </div>
294
+
295
+
296
+
297
+ <hr>
298
+
299
+ </header>
300
+
301
+ <body>
302
+
303
+
304
+
305
+ <%
306
+
307
+ LoggerTester lt = new LoggerTester();
308
+
309
+ lt.outActionLog("login.jsp", "処理開始");
310
+
311
+ %>
312
+
313
+
314
+
315
+ <div class="body">
316
+
317
+ <div class="content">
318
+
319
+ <div align="center">
320
+
321
+ <table border="0">
322
+
323
+ <form action="Login" method="POST">
324
+
325
+
326
+
327
+ <div class="break">
328
+
329
+ <font color="#fff">空欄作成のために使用。画面に映りません。</font>
330
+
331
+ </div>
332
+
333
+
334
+
335
+ <div class="break">
336
+
337
+ <font color="#fff">空欄作成のために使用。画面に映りません。</font>
338
+
339
+ </div>
340
+
341
+
342
+
343
+ <center>
344
+
345
+ <% if(loginErrorMessage != null){ %>
346
+
347
+ <p><font color="red"><%= loginErrorMessage %></font></p>
348
+
349
+ <%} %>
350
+
351
+ </center>
352
+
353
+ <div class="break">
354
+
355
+ <font color="#fff">空欄作成のために使用。画面に映りません。</font>
356
+
357
+ </div>
358
+
359
+
360
+
361
+ <p>ユーザーID
362
+
363
+ <input class="center" type="text" name="user_id" value="" size="24">
364
+
365
+ <p>パスワード
366
+
367
+ <input class="center" type="password" name="password" value="" size="24">
368
+
369
+ <br><br>
370
+
371
+ <input class="login" type="submit" name="login" value="ログイン"></div>
372
+
373
+
374
+
375
+
376
+
377
+ </form>
378
+
379
+ </table>
380
+
381
+
382
+
383
+ </div>
384
+
385
+ </div>
386
+
387
+ </div>
388
+
389
+ </body>
390
+
391
+
392
+
393
+ <footer>
394
+
395
+ <hr>
396
+
397
+
398
+
399
+ </div>
400
+
401
+ </html>
402
+
403
+ ```
404
+
405
+
406
+
407
+ ```DAO
408
+
409
+ package dao;
410
+
411
+
412
+
413
+ import java.io.Serializable;
414
+
415
+ import java.sql.SQLException;
416
+
417
+
418
+
419
+ public class UserDAO implements Serializable {
420
+
421
+
422
+
423
+ //アクセサメソッド
424
+
425
+ private String _loginid;
426
+
427
+ private String _userpassword;
428
+
429
+ private int _admin;
430
+
431
+ private String _name;
432
+
433
+
434
+
435
+ public void setloginid(String loginid) {
436
+
437
+ this._loginid = loginid;
438
+
439
+ }
440
+
441
+ public String getloginid() {
442
+
443
+ return this._loginid;
444
+
445
+ }
446
+
447
+
448
+
449
+ public void setuserpassword(String userpassword) {
450
+
451
+ this._userpassword = userpassword;
452
+
453
+ }
454
+
455
+ public String getuserpassword() {
456
+
457
+ return this._userpassword;
458
+
459
+ }
460
+
461
+
462
+
463
+ public void setadmin(int admin) {
464
+
465
+ this._admin = admin;
466
+
467
+ }
468
+
469
+ public int getadmin() {
470
+
471
+ return this._admin;
472
+
473
+ }
474
+
475
+
476
+
477
+ public void setname(String name) {
478
+
479
+ this._userpassword = name;
480
+
481
+ }
482
+
483
+ public String getname() {
484
+
485
+ return this._name;
486
+
487
+ }
488
+
489
+
490
+
491
+
492
+
493
+ //セットした情報を取得
494
+
495
+ public UserDAO selectUser(String loginid, String userpassword) throws ClassNotFoundException,SQLException{
496
+
497
+
498
+
499
+ UserDAO user = new UserDAO();
500
+
501
+
502
+
503
+ user.setloginid("00014");
504
+
505
+ user.setuserpassword("aaaaaa");
506
+
507
+ user.setadmin(0);
508
+
509
+ user.setname("tarou");
510
+
511
+
512
+
513
+ // 戻り値の設定
514
+
515
+ return user;
516
+
517
+ }
518
+
519
+
520
+
521
+ }
522
+
523
+ ```
524
+
525
+
526
+
253
527
  #ファイル構成
254
528
 
255
529