質問するログイン新規登録

質問編集履歴

2

index.html→index.jspに変更しました。

2025/07/18 09:23

投稿

hand45major56
hand45major56

スコア0

title CHANGED
File without changes
body CHANGED
@@ -262,45 +262,51 @@
262
262
 
263
263
  ```
264
264
 
265
- ```index.html
265
+ ```index.jsp
266
- <!DOCTYPE html>
266
+ <%@ page import="bean.EmployeeBean"%>
267
+
268
+ <%
269
+ // 問① getAttributeに適切な引数をセットして、EmployeeControllerから渡されたEmployeeBeanを取得してください。
270
+ EmployeeBean employeeBean = (EmployeeBean) request.getAttribute("employeeBean");
271
+ %>
272
+ <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
267
273
  <html>
268
274
  <head>
269
- <meta charset="UTF-8">
275
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
270
- <title>社員情報システム</title>
276
+ <title>検索結果</title>
271
- <link rel="stylesheet" type="text/css" href="./css/index.css">
272
277
  </head>
273
278
  <body>
274
- <form action="/SC3-A/search" method="post">
275
- <div class="wrapper">
276
- <div class="header">
279
+ <div align="center">
280
+ <!-- 検索が成功した場合の表示 -->
281
+ <%
282
+ if (employeeBean != null) {
283
+ %>
284
+ <table border="1">
285
+ <tr>
286
+ <th>社員名</th>
277
- <div class="inner">社員情報システム</div>
287
+ <td><%=employeeBean.getName()%></td>
288
+ </tr>
289
+ <tr>
290
+ <th>コメント</th>
291
+ <td><%=employeeBean.getComment()%></td>
292
+ </tr>
293
+ <tr>
294
+ <th>ログインタイム</th>
295
+ <td><%=employeeBean.getLogin_Time()%></td>
296
+ </tr>
297
+ </table>
298
+
299
+ <!-- 問② それ以外の表示(エラーの場合)-->
300
+ <% } else { %>
301
+ <p>IDもしくはパスワードが間違ってます</p>
302
+ <% } %>
278
- </div>
303
+ </div>
279
- <ul>
304
+
280
- <!-- ID入力欄 -->
281
- <li class="id">
282
- <label for="id">ID</label>
283
- <input type="text" name="id" value="" size="20">
284
- </li>
285
- <!-- パスワードを入力する欄を作成してください -->
286
- <li class="pass">
287
- <label for="password">pass</label>
288
- <input type="password" name="password" value="" size="20">
289
- </li>
290
- <!-- 検索ボタン -->
291
- <li>
292
- <input id="button" type="submit" name="button" value="検索">
293
- </li>
294
- </ul>
295
- <div class="footer">
296
- <div class="inner">hogehoge.inc</div>
297
- </div>
298
- </div>
299
- </form>
300
305
  </body>
301
306
  </html>
302
307
 
303
308
 
309
+
304
310
  ```
305
311
 
306
312
  ### 試したこと・調べたこと

1

添付画像を修正しました。

2025/07/17 23:21

投稿

hand45major56
hand45major56

スコア0

title CHANGED
File without changes
body CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  ### 発生している問題・分からないこと
7
7
  データベースでpdAdmin4を使用してカラム(id,password,name,comment,login_time)も間違えていないが、index.htmlにて実行しても
8
- 「idとパスワードが間違っています」となり、ログイン成功しない。![![イメージ説明](https://ddjkaamml8q8x.cloudfront.net/questions/2025-07-17/c112b69f-e6d4-45b4-9e6e-fe907acb8fd0.png)](https://ddjkaamml8q8x.cloudfront.net/questions/2025-07-17/90d0b972-a1d6-4ae4-849b-cb22dc1682fc.png)
8
+ 「idとパスワードが間違っています」となり、ログイン成功しない。![イメージ説明](https://ddjkaamml8q8x.cloudfront.net/questions/2025-07-18/2fbb5007-c102-473a-b82d-330f0f350a24.png)
9
9
 
10
10
 
11
11