質問編集履歴
1
誤字
title
CHANGED
File without changes
|
body
CHANGED
@@ -124,6 +124,143 @@
|
|
124
124
|
}
|
125
125
|
```
|
126
126
|
|
127
|
+
```jsp
|
128
|
+
<%@ page language="java" contentType="text/html; charset=UTF-8"
|
129
|
+
pageEncoding="UTF-8"%>
|
130
|
+
<%@ page import="exam.LoggerTester" %>
|
131
|
+
<% request.setCharacterEncoding("UTF-8"); %>
|
132
|
+
<% String loginErrorMessage = (String)request.getAttribute("loginErrorMessage"); %>
|
133
|
+
<!DOCTYPE html>
|
134
|
+
<html>
|
135
|
+
<head>
|
136
|
+
<meta charset="UTF-8">
|
137
|
+
<title>書籍管理システム-<ログイン></title>
|
138
|
+
<link rel="stylesheet" href="header.css">
|
139
|
+
</head>
|
140
|
+
|
141
|
+
<div class="container">
|
142
|
+
<header>
|
143
|
+
|
144
|
+
<div class="header_logo_font">
|
145
|
+
<p>書籍管理システムログイン</p>
|
146
|
+
</div>
|
147
|
+
</div>
|
148
|
+
|
149
|
+
<hr>
|
150
|
+
</header>
|
151
|
+
<body>
|
152
|
+
|
153
|
+
<%
|
154
|
+
LoggerTester lt = new LoggerTester();
|
155
|
+
lt.outActionLog("login.jsp", "処理開始");
|
156
|
+
%>
|
157
|
+
|
158
|
+
<div class="body">
|
159
|
+
<div class="content">
|
160
|
+
<div align="center">
|
161
|
+
<table border="0">
|
162
|
+
<form action="Login" method="POST">
|
163
|
+
|
164
|
+
<div class="break">
|
165
|
+
<font color="#fff">空欄作成のために使用。画面に映りません。</font>
|
166
|
+
</div>
|
167
|
+
|
168
|
+
<div class="break">
|
169
|
+
<font color="#fff">空欄作成のために使用。画面に映りません。</font>
|
170
|
+
</div>
|
171
|
+
|
172
|
+
<center>
|
173
|
+
<% if(loginErrorMessage != null){ %>
|
174
|
+
<p><font color="red"><%= loginErrorMessage %></font></p>
|
175
|
+
<%} %>
|
176
|
+
</center>
|
177
|
+
<div class="break">
|
178
|
+
<font color="#fff">空欄作成のために使用。画面に映りません。</font>
|
179
|
+
</div>
|
180
|
+
|
181
|
+
<p>ユーザーID
|
182
|
+
<input class="center" type="text" name="user_id" value="" size="24">
|
183
|
+
<p>パスワード
|
184
|
+
<input class="center" type="password" name="password" value="" size="24">
|
185
|
+
<br><br>
|
186
|
+
<input class="login" type="submit" name="login" value="ログイン"></div>
|
187
|
+
|
188
|
+
|
189
|
+
</form>
|
190
|
+
</table>
|
191
|
+
|
192
|
+
</div>
|
193
|
+
</div>
|
194
|
+
</div>
|
195
|
+
</body>
|
196
|
+
|
197
|
+
<footer>
|
198
|
+
<hr>
|
199
|
+
|
200
|
+
</div>
|
201
|
+
</html>
|
202
|
+
```
|
203
|
+
|
204
|
+
```DAO
|
205
|
+
package dao;
|
206
|
+
|
207
|
+
import java.io.Serializable;
|
208
|
+
import java.sql.SQLException;
|
209
|
+
|
210
|
+
public class UserDAO implements Serializable {
|
211
|
+
|
212
|
+
//アクセサメソッド
|
213
|
+
private String _loginid;
|
214
|
+
private String _userpassword;
|
215
|
+
private int _admin;
|
216
|
+
private String _name;
|
217
|
+
|
218
|
+
public void setloginid(String loginid) {
|
219
|
+
this._loginid = loginid;
|
220
|
+
}
|
221
|
+
public String getloginid() {
|
222
|
+
return this._loginid;
|
223
|
+
}
|
224
|
+
|
225
|
+
public void setuserpassword(String userpassword) {
|
226
|
+
this._userpassword = userpassword;
|
227
|
+
}
|
228
|
+
public String getuserpassword() {
|
229
|
+
return this._userpassword;
|
230
|
+
}
|
231
|
+
|
232
|
+
public void setadmin(int admin) {
|
233
|
+
this._admin = admin;
|
234
|
+
}
|
235
|
+
public int getadmin() {
|
236
|
+
return this._admin;
|
237
|
+
}
|
238
|
+
|
239
|
+
public void setname(String name) {
|
240
|
+
this._userpassword = name;
|
241
|
+
}
|
242
|
+
public String getname() {
|
243
|
+
return this._name;
|
244
|
+
}
|
245
|
+
|
246
|
+
|
247
|
+
//セットした情報を取得
|
248
|
+
public UserDAO selectUser(String loginid, String userpassword) throws ClassNotFoundException,SQLException{
|
249
|
+
|
250
|
+
UserDAO user = new UserDAO();
|
251
|
+
|
252
|
+
user.setloginid("00014");
|
253
|
+
user.setuserpassword("aaaaaa");
|
254
|
+
user.setadmin(0);
|
255
|
+
user.setname("tarou");
|
256
|
+
|
257
|
+
// 戻り値の設定
|
258
|
+
return user;
|
259
|
+
}
|
260
|
+
|
261
|
+
}
|
262
|
+
```
|
263
|
+
|
127
264
|
#ファイル構成
|
128
265
|
|
129
266
|

|