質問編集履歴
4
やったことの追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -576,7 +576,9 @@
|
|
576
576
|
|
577
577
|
②ソースコードの見直し
|
578
578
|
|
579
|
-
③ライブラリにMySQLのJDBCドライバの指定(mysql-connector-java-
|
579
|
+
③ライブラリにMySQLのJDBCドライバの指定(mysql-connector-java-8.0.25-bin.jar)
|
580
|
+
|
581
|
+
④[データベースからのエンティティクラスの作成](https://netbeans.apache.org/kb/docs/web/jsf20-crud_ja.html)
|
580
582
|
|
581
583
|
|
582
584
|
|
3
書式の改善
test
CHANGED
File without changes
|
test
CHANGED
@@ -22,552 +22,552 @@
|
|
22
22
|
|
23
23
|
|
24
24
|
|
25
|
+
```エラーメッセージ
|
26
|
+
|
27
|
+
HTTP Status 500 - Internal Server Error
|
28
|
+
|
29
|
+
|
30
|
+
|
31
|
+
|
32
|
+
|
33
|
+
type Exception report
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
messageInternal Server Error
|
38
|
+
|
39
|
+
|
40
|
+
|
41
|
+
descriptionThe server encountered an internal error that prevented it from fulfilling this request.
|
42
|
+
|
43
|
+
|
44
|
+
|
45
|
+
exception
|
46
|
+
|
47
|
+
javax.servlet.ServletException: Target Unreachable, identifier 'BookSearcher' resolved to null
|
48
|
+
|
49
|
+
|
50
|
+
|
51
|
+
|
52
|
+
|
53
|
+
root cause
|
54
|
+
|
55
|
+
javax.el.PropertyNotFoundException: Target Unreachable, identifier 'BookSearcher' resolved to null
|
56
|
+
|
57
|
+
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
note The full stack traces of the exception and its root causes are available in the GlassFish Server Open Source Edition 4.1.1 logs.
|
62
|
+
|
63
|
+
|
64
|
+
|
65
|
+
```
|
66
|
+
|
67
|
+
#ソースコード
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
##ManagedBean
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
```BookSearcher
|
76
|
+
|
77
|
+
import java.util.List;
|
78
|
+
|
79
|
+
import java.util.ArrayList;
|
80
|
+
|
81
|
+
import java.sql.*;
|
82
|
+
|
83
|
+
import javax.sql.*;
|
84
|
+
|
85
|
+
import javax.faces.context.FacesContext;
|
86
|
+
|
87
|
+
import javax.faces.el.ValueBinding;
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
public class BookSearcher {
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
private String word = "";
|
96
|
+
|
97
|
+
private String id = "";
|
98
|
+
|
99
|
+
private List list = null;
|
100
|
+
|
101
|
+
private BookData book = null;
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
public void setWord(String word) {
|
106
|
+
|
107
|
+
this.word = word;
|
108
|
+
|
109
|
+
}
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
public String getWord() {
|
114
|
+
|
115
|
+
return word;
|
116
|
+
|
117
|
+
}
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
public List getBookList() {
|
122
|
+
|
123
|
+
return list;
|
124
|
+
|
125
|
+
}
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
public BookData getBookData() {
|
130
|
+
|
131
|
+
return book;
|
132
|
+
|
133
|
+
}
|
134
|
+
|
135
|
+
|
136
|
+
|
137
|
+
public String searchBooks() {
|
138
|
+
|
139
|
+
searchBooks(word);
|
140
|
+
|
141
|
+
return "success";
|
142
|
+
|
143
|
+
}
|
144
|
+
|
145
|
+
|
146
|
+
|
147
|
+
private void searchBooks(String word) {
|
148
|
+
|
149
|
+
list = new ArrayList();
|
150
|
+
|
151
|
+
try {
|
152
|
+
|
153
|
+
Class.forName("org.gjt.mm.mysql.Driver");
|
154
|
+
|
155
|
+
String url = "jdbc:mysql://localhost/library";
|
156
|
+
|
157
|
+
Connection con = DriverManager.getConnection(url, "root", "chhagane");
|
158
|
+
|
159
|
+
|
160
|
+
|
161
|
+
String selectStatement =
|
162
|
+
|
163
|
+
"select * " +
|
164
|
+
|
165
|
+
"from books where ndc like ? " +
|
166
|
+
|
167
|
+
"or tyosya_hyouji like ? " +
|
168
|
+
|
169
|
+
"or id like ? " +
|
170
|
+
|
171
|
+
"or title like ? " +
|
172
|
+
|
173
|
+
"or author like ? " +
|
174
|
+
|
175
|
+
"or publisher like ? ";
|
176
|
+
|
177
|
+
PreparedStatement prepStmt =
|
178
|
+
|
179
|
+
con.prepareStatement(selectStatement);
|
180
|
+
|
181
|
+
prepStmt.setString(1, appendPercent(word));
|
182
|
+
|
183
|
+
prepStmt.setString(2, appendPercent(word));
|
184
|
+
|
185
|
+
prepStmt.setString(3, appendPercent(word));
|
186
|
+
|
187
|
+
prepStmt.setString(4, appendPercent(word));
|
188
|
+
|
189
|
+
prepStmt.setString(5, appendPercent(word));
|
190
|
+
|
191
|
+
prepStmt.setString(6, appendPercent(word));
|
192
|
+
|
193
|
+
|
194
|
+
|
195
|
+
ResultSet rs = prepStmt.executeQuery();
|
196
|
+
|
197
|
+
while (rs.next()) {
|
198
|
+
|
199
|
+
BookData book = new BookData();
|
200
|
+
|
201
|
+
book.setNdc(rs.getString("ndc"));
|
202
|
+
|
203
|
+
book.setTyosya_hyouji(rs.getString("tyosya_hyouji"));
|
204
|
+
|
205
|
+
book.setId(rs.getString("id"));
|
206
|
+
|
207
|
+
book.setTitle(rs.getString("title"));
|
208
|
+
|
209
|
+
book.setAuthor(rs.getString("author"));
|
210
|
+
|
211
|
+
book.setPublisher(rs.getString("publisher"));
|
212
|
+
|
213
|
+
list.add(book);
|
214
|
+
|
215
|
+
}
|
216
|
+
|
217
|
+
prepStmt.close();
|
218
|
+
|
219
|
+
} catch (ClassNotFoundException e) {
|
220
|
+
|
221
|
+
e.printStackTrace();
|
222
|
+
|
223
|
+
} catch (SQLException e) {
|
224
|
+
|
225
|
+
e.printStackTrace();
|
226
|
+
|
227
|
+
}
|
228
|
+
|
229
|
+
}
|
230
|
+
|
231
|
+
|
232
|
+
|
233
|
+
private String appendPercent(String from) {
|
234
|
+
|
235
|
+
StringBuffer to = new StringBuffer();
|
236
|
+
|
237
|
+
to.append("%");
|
238
|
+
|
239
|
+
to.append(from);
|
240
|
+
|
241
|
+
to.append("%");
|
242
|
+
|
243
|
+
|
244
|
+
|
245
|
+
return new String(to);
|
246
|
+
|
247
|
+
}
|
248
|
+
|
249
|
+
|
250
|
+
|
251
|
+
}
|
252
|
+
|
253
|
+
```
|
254
|
+
|
255
|
+
|
256
|
+
|
257
|
+
```BookData
|
258
|
+
|
259
|
+
import javax.inject.Named;
|
260
|
+
|
261
|
+
import javax.enterprise.context.Dependent;
|
262
|
+
|
263
|
+
|
264
|
+
|
265
|
+
import java.io.Serializable;
|
266
|
+
|
267
|
+
|
268
|
+
|
269
|
+
@Named(value = "bookData")
|
270
|
+
|
271
|
+
@Dependent
|
272
|
+
|
273
|
+
public class BookData {
|
274
|
+
|
275
|
+
private String ndc ="";
|
276
|
+
|
277
|
+
private String tyosya_hyouji ="";
|
278
|
+
|
279
|
+
private String id ="";
|
280
|
+
|
281
|
+
private String title ="";
|
282
|
+
|
283
|
+
private String author ="";
|
284
|
+
|
285
|
+
private String publisher ="";
|
286
|
+
|
287
|
+
|
288
|
+
|
289
|
+
public String getNdc(){
|
290
|
+
|
291
|
+
return ndc;
|
292
|
+
|
293
|
+
}
|
294
|
+
|
295
|
+
|
296
|
+
|
297
|
+
public void setNdc(String ndc){
|
298
|
+
|
299
|
+
this.ndc=ndc;
|
300
|
+
|
301
|
+
}
|
302
|
+
|
303
|
+
public String getTyosya_hyouji(){
|
304
|
+
|
305
|
+
return tyosya_hyouji;
|
306
|
+
|
307
|
+
}
|
308
|
+
|
309
|
+
|
310
|
+
|
311
|
+
public void setTyosya_hyouji(String tyosya_hyouji){
|
312
|
+
|
313
|
+
this.tyosya_hyouji=tyosya_hyouji;
|
314
|
+
|
315
|
+
}
|
316
|
+
|
317
|
+
public String getId(){
|
318
|
+
|
319
|
+
return id;
|
320
|
+
|
321
|
+
}
|
322
|
+
|
323
|
+
|
324
|
+
|
325
|
+
public void setId(String id){
|
326
|
+
|
327
|
+
this.id=id;
|
328
|
+
|
329
|
+
}
|
330
|
+
|
331
|
+
public String getTitle(){
|
332
|
+
|
333
|
+
return title;
|
334
|
+
|
335
|
+
}
|
336
|
+
|
337
|
+
|
338
|
+
|
339
|
+
public void setTitle(String title){
|
340
|
+
|
341
|
+
this.title=title;
|
342
|
+
|
343
|
+
}
|
344
|
+
|
345
|
+
public String getAuthor(){
|
346
|
+
|
347
|
+
return author;
|
348
|
+
|
349
|
+
}
|
350
|
+
|
351
|
+
|
352
|
+
|
353
|
+
public void setAuthor(String author){
|
354
|
+
|
355
|
+
this.author=author;
|
356
|
+
|
357
|
+
}
|
358
|
+
|
359
|
+
public String getPubliser(){
|
360
|
+
|
361
|
+
return publisher;
|
362
|
+
|
363
|
+
}
|
364
|
+
|
365
|
+
|
366
|
+
|
367
|
+
public void setPublisher(String publisher){
|
368
|
+
|
369
|
+
this.publisher=publisher;
|
370
|
+
|
371
|
+
}
|
372
|
+
|
373
|
+
}
|
374
|
+
|
375
|
+
|
376
|
+
|
377
|
+
```
|
378
|
+
|
379
|
+
|
380
|
+
|
381
|
+
##JSPファイル
|
382
|
+
|
383
|
+
```search
|
384
|
+
|
385
|
+
<%@ page contentType="text/html; charset=Shift_JIS" %>
|
386
|
+
|
387
|
+
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
|
388
|
+
|
389
|
+
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
|
390
|
+
|
391
|
+
|
392
|
+
|
393
|
+
<html>
|
394
|
+
|
395
|
+
<head>
|
396
|
+
|
397
|
+
<link href="style.css" type="text/css" rel="stylesheet" />
|
398
|
+
|
399
|
+
<title>図書検索</title>
|
400
|
+
|
401
|
+
</head>
|
402
|
+
|
403
|
+
<body>
|
404
|
+
|
405
|
+
|
406
|
+
|
407
|
+
<h1>図書検索</h1>
|
408
|
+
|
409
|
+
|
410
|
+
|
411
|
+
<hr />
|
412
|
+
|
413
|
+
|
414
|
+
|
415
|
+
<f:view>
|
416
|
+
|
417
|
+
<h:form id="searchForm">
|
418
|
+
|
419
|
+
<h:inputText id="searchWord" value="#{BookSearcher.word}" />
|
420
|
+
|
421
|
+
<h:commandButton id="submit"
|
422
|
+
|
423
|
+
action="#{BookSearcher.searchBooks}" value="Go!" />
|
424
|
+
|
425
|
+
</h:form>
|
426
|
+
|
427
|
+
</f:view>
|
428
|
+
|
429
|
+
|
430
|
+
|
431
|
+
</body>
|
432
|
+
|
433
|
+
</html>
|
434
|
+
|
435
|
+
```
|
436
|
+
|
437
|
+
|
438
|
+
|
439
|
+
```list
|
440
|
+
|
441
|
+
<%@ page contentType="text/html; charset=Shift_JIS" %>
|
442
|
+
|
443
|
+
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
|
444
|
+
|
445
|
+
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
|
446
|
+
|
447
|
+
|
448
|
+
|
449
|
+
<!DOCTYPE html>
|
450
|
+
|
451
|
+
<html>
|
452
|
+
|
453
|
+
<head>
|
454
|
+
|
455
|
+
<title>検索結果</title>
|
456
|
+
|
457
|
+
</head>
|
458
|
+
|
459
|
+
<body>
|
460
|
+
|
461
|
+
<h1>検索結果</h1>
|
462
|
+
|
463
|
+
|
464
|
+
|
465
|
+
<f:view>
|
466
|
+
|
467
|
+
<h:form id="listForm">
|
468
|
+
|
469
|
+
<h:dataTable id="table" border="1" value="#{BookSearcher.booklist}" var="book">
|
470
|
+
|
471
|
+
<h:column>
|
472
|
+
|
473
|
+
<f:facet name="header">
|
474
|
+
|
475
|
+
<h:outputText value="タイトル"/>
|
476
|
+
|
477
|
+
</f:facet>
|
478
|
+
|
479
|
+
<h:outputText id="bookTitle" value="#{book.title}"/>
|
480
|
+
|
481
|
+
</h:column>
|
482
|
+
|
483
|
+
<h:column>
|
484
|
+
|
485
|
+
<f:facet name="header">
|
486
|
+
|
487
|
+
<h:outputText value="著者"/>
|
488
|
+
|
489
|
+
</f:facet>
|
490
|
+
|
491
|
+
<h:outputText id="bookAuthor" value="#{book.author}"/>
|
492
|
+
|
493
|
+
</h:column>
|
494
|
+
|
495
|
+
</h:dataTable>
|
496
|
+
|
497
|
+
</h:form>
|
498
|
+
|
499
|
+
</f:view>
|
500
|
+
|
501
|
+
</body>
|
502
|
+
|
503
|
+
</html>
|
504
|
+
|
505
|
+
|
506
|
+
|
507
|
+
```
|
508
|
+
|
509
|
+
##web.xml
|
510
|
+
|
511
|
+
|
512
|
+
|
25
513
|
```ここに言語を入力
|
26
514
|
|
515
|
+
<?xml version='1.0' encoding='UTF-8'?>
|
516
|
+
|
517
|
+
|
518
|
+
|
27
|
-
|
519
|
+
<!DOCTYPE web-app PUBLIC
|
520
|
+
|
28
|
-
|
521
|
+
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
|
522
|
+
|
29
|
-
|
523
|
+
"http://java.sun.com/dtd/web-app_2_3.dtd">
|
524
|
+
|
525
|
+
|
526
|
+
|
30
|
-
|
527
|
+
<web-app>
|
528
|
+
|
529
|
+
|
530
|
+
|
31
|
-
|
531
|
+
<display-name>
|
532
|
+
|
32
|
-
|
533
|
+
JSF: library-search
|
534
|
+
|
535
|
+
</display-name>
|
536
|
+
|
33
|
-
|
537
|
+
<description>
|
34
|
-
|
35
|
-
|
36
|
-
|
538
|
+
|
37
|
-
|
539
|
+
JSF: library-search
|
540
|
+
|
38
|
-
|
541
|
+
</description>
|
542
|
+
|
543
|
+
|
544
|
+
|
39
|
-
|
545
|
+
<servlet>
|
40
|
-
|
546
|
+
|
41
|
-
|
547
|
+
<servlet-name>Faces Servlet</servlet-name>
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
548
|
+
|
46
|
-
|
47
|
-
javax.se
|
549
|
+
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
|
550
|
+
|
48
|
-
|
551
|
+
<load-on-startup> 1 </load-on-startup>
|
552
|
+
|
49
|
-
|
553
|
+
</servlet>
|
50
|
-
|
51
|
-
|
52
|
-
|
554
|
+
|
555
|
+
|
556
|
+
|
53
|
-
r
|
557
|
+
<servlet-mapping>
|
54
|
-
|
558
|
+
|
55
|
-
|
559
|
+
<servlet-name>Faces Servlet</servlet-name>
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
560
|
+
|
61
|
-
|
561
|
+
<url-pattern>/jsp/*</url-pattern>
|
562
|
+
|
62
|
-
|
563
|
+
</servlet-mapping>
|
564
|
+
|
565
|
+
|
566
|
+
|
63
|
-
|
567
|
+
</web-app>
|
64
568
|
|
65
569
|
```
|
66
570
|
|
67
|
-
ソースコード
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
##ManagedBean
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
```BookSearcher
|
76
|
-
|
77
|
-
import java.util.List;
|
78
|
-
|
79
|
-
import java.util.ArrayList;
|
80
|
-
|
81
|
-
import java.sql.*;
|
82
|
-
|
83
|
-
import javax.sql.*;
|
84
|
-
|
85
|
-
import javax.faces.context.FacesContext;
|
86
|
-
|
87
|
-
import javax.faces.el.ValueBinding;
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
public class BookSearcher {
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
private String word = "";
|
96
|
-
|
97
|
-
private String id = "";
|
98
|
-
|
99
|
-
private List list = null;
|
100
|
-
|
101
|
-
private BookData book = null;
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
public void setWord(String word) {
|
106
|
-
|
107
|
-
this.word = word;
|
108
|
-
|
109
|
-
}
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
public String getWord() {
|
114
|
-
|
115
|
-
return word;
|
116
|
-
|
117
|
-
}
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
public List getBookList() {
|
122
|
-
|
123
|
-
return list;
|
124
|
-
|
125
|
-
}
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
public BookData getBookData() {
|
130
|
-
|
131
|
-
return book;
|
132
|
-
|
133
|
-
}
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
public String searchBooks() {
|
138
|
-
|
139
|
-
searchBooks(word);
|
140
|
-
|
141
|
-
return "success";
|
142
|
-
|
143
|
-
}
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
private void searchBooks(String word) {
|
148
|
-
|
149
|
-
list = new ArrayList();
|
150
|
-
|
151
|
-
try {
|
152
|
-
|
153
|
-
Class.forName("org.gjt.mm.mysql.Driver");
|
154
|
-
|
155
|
-
String url = "jdbc:mysql://localhost/library";
|
156
|
-
|
157
|
-
Connection con = DriverManager.getConnection(url, "root", "chhagane");
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
String selectStatement =
|
162
|
-
|
163
|
-
"select * " +
|
164
|
-
|
165
|
-
"from books where ndc like ? " +
|
166
|
-
|
167
|
-
"or tyosya_hyouji like ? " +
|
168
|
-
|
169
|
-
"or id like ? " +
|
170
|
-
|
171
|
-
"or title like ? " +
|
172
|
-
|
173
|
-
"or author like ? " +
|
174
|
-
|
175
|
-
"or publisher like ? ";
|
176
|
-
|
177
|
-
PreparedStatement prepStmt =
|
178
|
-
|
179
|
-
con.prepareStatement(selectStatement);
|
180
|
-
|
181
|
-
prepStmt.setString(1, appendPercent(word));
|
182
|
-
|
183
|
-
prepStmt.setString(2, appendPercent(word));
|
184
|
-
|
185
|
-
prepStmt.setString(3, appendPercent(word));
|
186
|
-
|
187
|
-
prepStmt.setString(4, appendPercent(word));
|
188
|
-
|
189
|
-
prepStmt.setString(5, appendPercent(word));
|
190
|
-
|
191
|
-
prepStmt.setString(6, appendPercent(word));
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
ResultSet rs = prepStmt.executeQuery();
|
196
|
-
|
197
|
-
while (rs.next()) {
|
198
|
-
|
199
|
-
BookData book = new BookData();
|
200
|
-
|
201
|
-
book.setNdc(rs.getString("ndc"));
|
202
|
-
|
203
|
-
book.setTyosya_hyouji(rs.getString("tyosya_hyouji"));
|
204
|
-
|
205
|
-
book.setId(rs.getString("id"));
|
206
|
-
|
207
|
-
book.setTitle(rs.getString("title"));
|
208
|
-
|
209
|
-
book.setAuthor(rs.getString("author"));
|
210
|
-
|
211
|
-
book.setPublisher(rs.getString("publisher"));
|
212
|
-
|
213
|
-
list.add(book);
|
214
|
-
|
215
|
-
}
|
216
|
-
|
217
|
-
prepStmt.close();
|
218
|
-
|
219
|
-
} catch (ClassNotFoundException e) {
|
220
|
-
|
221
|
-
e.printStackTrace();
|
222
|
-
|
223
|
-
} catch (SQLException e) {
|
224
|
-
|
225
|
-
e.printStackTrace();
|
226
|
-
|
227
|
-
}
|
228
|
-
|
229
|
-
}
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
private String appendPercent(String from) {
|
234
|
-
|
235
|
-
StringBuffer to = new StringBuffer();
|
236
|
-
|
237
|
-
to.append("%");
|
238
|
-
|
239
|
-
to.append(from);
|
240
|
-
|
241
|
-
to.append("%");
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
return new String(to);
|
246
|
-
|
247
|
-
}
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
}
|
252
|
-
|
253
|
-
```
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
```BookData
|
258
|
-
|
259
|
-
import javax.inject.Named;
|
260
|
-
|
261
|
-
import javax.enterprise.context.Dependent;
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
import java.io.Serializable;
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
@Named(value = "bookData")
|
270
|
-
|
271
|
-
@Dependent
|
272
|
-
|
273
|
-
public class BookData {
|
274
|
-
|
275
|
-
private String ndc ="";
|
276
|
-
|
277
|
-
private String tyosya_hyouji ="";
|
278
|
-
|
279
|
-
private String id ="";
|
280
|
-
|
281
|
-
private String title ="";
|
282
|
-
|
283
|
-
private String author ="";
|
284
|
-
|
285
|
-
private String publisher ="";
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
public String getNdc(){
|
290
|
-
|
291
|
-
return ndc;
|
292
|
-
|
293
|
-
}
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
public void setNdc(String ndc){
|
298
|
-
|
299
|
-
this.ndc=ndc;
|
300
|
-
|
301
|
-
}
|
302
|
-
|
303
|
-
public String getTyosya_hyouji(){
|
304
|
-
|
305
|
-
return tyosya_hyouji;
|
306
|
-
|
307
|
-
}
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
public void setTyosya_hyouji(String tyosya_hyouji){
|
312
|
-
|
313
|
-
this.tyosya_hyouji=tyosya_hyouji;
|
314
|
-
|
315
|
-
}
|
316
|
-
|
317
|
-
public String getId(){
|
318
|
-
|
319
|
-
return id;
|
320
|
-
|
321
|
-
}
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
public void setId(String id){
|
326
|
-
|
327
|
-
this.id=id;
|
328
|
-
|
329
|
-
}
|
330
|
-
|
331
|
-
public String getTitle(){
|
332
|
-
|
333
|
-
return title;
|
334
|
-
|
335
|
-
}
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
public void setTitle(String title){
|
340
|
-
|
341
|
-
this.title=title;
|
342
|
-
|
343
|
-
}
|
344
|
-
|
345
|
-
public String getAuthor(){
|
346
|
-
|
347
|
-
return author;
|
348
|
-
|
349
|
-
}
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
public void setAuthor(String author){
|
354
|
-
|
355
|
-
this.author=author;
|
356
|
-
|
357
|
-
}
|
358
|
-
|
359
|
-
public String getPubliser(){
|
360
|
-
|
361
|
-
return publisher;
|
362
|
-
|
363
|
-
}
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
public void setPublisher(String publisher){
|
368
|
-
|
369
|
-
this.publisher=publisher;
|
370
|
-
|
371
|
-
}
|
372
|
-
|
373
|
-
}
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
```
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
##JSPファイル
|
382
|
-
|
383
|
-
```search
|
384
|
-
|
385
|
-
<%@ page contentType="text/html; charset=Shift_JIS" %>
|
386
|
-
|
387
|
-
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
|
388
|
-
|
389
|
-
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
<html>
|
394
|
-
|
395
|
-
<head>
|
396
|
-
|
397
|
-
<link href="style.css" type="text/css" rel="stylesheet" />
|
398
|
-
|
399
|
-
<title>図書検索</title>
|
400
|
-
|
401
|
-
</head>
|
402
|
-
|
403
|
-
<body>
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
<h1>図書検索</h1>
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
<hr />
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
<f:view>
|
416
|
-
|
417
|
-
<h:form id="searchForm">
|
418
|
-
|
419
|
-
<h:inputText id="searchWord" value="#{BookSearcher.word}" />
|
420
|
-
|
421
|
-
<h:commandButton id="submit"
|
422
|
-
|
423
|
-
action="#{BookSearcher.searchBooks}" value="Go!" />
|
424
|
-
|
425
|
-
</h:form>
|
426
|
-
|
427
|
-
</f:view>
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
</body>
|
432
|
-
|
433
|
-
</html>
|
434
|
-
|
435
|
-
```
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
```list
|
440
|
-
|
441
|
-
<%@ page contentType="text/html; charset=Shift_JIS" %>
|
442
|
-
|
443
|
-
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
|
444
|
-
|
445
|
-
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
<!DOCTYPE html>
|
450
|
-
|
451
|
-
<html>
|
452
|
-
|
453
|
-
<head>
|
454
|
-
|
455
|
-
<title>検索結果</title>
|
456
|
-
|
457
|
-
</head>
|
458
|
-
|
459
|
-
<body>
|
460
|
-
|
461
|
-
<h1>検索結果</h1>
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
<f:view>
|
466
|
-
|
467
|
-
<h:form id="listForm">
|
468
|
-
|
469
|
-
<h:dataTable id="table" border="1" value="#{BookSearcher.booklist}" var="book">
|
470
|
-
|
471
|
-
<h:column>
|
472
|
-
|
473
|
-
<f:facet name="header">
|
474
|
-
|
475
|
-
<h:outputText value="タイトル"/>
|
476
|
-
|
477
|
-
</f:facet>
|
478
|
-
|
479
|
-
<h:outputText id="bookTitle" value="#{book.title}"/>
|
480
|
-
|
481
|
-
</h:column>
|
482
|
-
|
483
|
-
<h:column>
|
484
|
-
|
485
|
-
<f:facet name="header">
|
486
|
-
|
487
|
-
<h:outputText value="著者"/>
|
488
|
-
|
489
|
-
</f:facet>
|
490
|
-
|
491
|
-
<h:outputText id="bookAuthor" value="#{book.author}"/>
|
492
|
-
|
493
|
-
</h:column>
|
494
|
-
|
495
|
-
</h:dataTable>
|
496
|
-
|
497
|
-
</h:form>
|
498
|
-
|
499
|
-
</f:view>
|
500
|
-
|
501
|
-
</body>
|
502
|
-
|
503
|
-
</html>
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
```
|
508
|
-
|
509
|
-
##web.xml
|
510
|
-
|
511
|
-
|
512
|
-
|
513
|
-
```ここに言語を入力
|
514
|
-
|
515
|
-
<?xml version='1.0' encoding='UTF-8'?>
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
<!DOCTYPE web-app PUBLIC
|
520
|
-
|
521
|
-
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
|
522
|
-
|
523
|
-
"http://java.sun.com/dtd/web-app_2_3.dtd">
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
<web-app>
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
<display-name>
|
532
|
-
|
533
|
-
JSF: library-search
|
534
|
-
|
535
|
-
</display-name>
|
536
|
-
|
537
|
-
<description>
|
538
|
-
|
539
|
-
JSF: library-search
|
540
|
-
|
541
|
-
</description>
|
542
|
-
|
543
|
-
|
544
|
-
|
545
|
-
<servlet>
|
546
|
-
|
547
|
-
<servlet-name>Faces Servlet</servlet-name>
|
548
|
-
|
549
|
-
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
|
550
|
-
|
551
|
-
<load-on-startup> 1 </load-on-startup>
|
552
|
-
|
553
|
-
</servlet>
|
554
|
-
|
555
|
-
|
556
|
-
|
557
|
-
<servlet-mapping>
|
558
|
-
|
559
|
-
<servlet-name>Faces Servlet</servlet-name>
|
560
|
-
|
561
|
-
<url-pattern>/jsp/*</url-pattern>
|
562
|
-
|
563
|
-
</servlet-mapping>
|
564
|
-
|
565
|
-
|
566
|
-
|
567
|
-
</web-app>
|
568
|
-
|
569
|
-
```
|
570
|
-
|
571
571
|
|
572
572
|
|
573
573
|
#試したこと
|
2
ドライバの追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -12,6 +12,8 @@
|
|
12
12
|
|
13
13
|
Java:15.0.2、jre1.8.0
|
14
14
|
|
15
|
+
ドライバ:mysql-connector-java-8.0.25.jar
|
16
|
+
|
15
17
|
IDE:Netbeans
|
16
18
|
|
17
19
|
DB:MySQL
|
1
質問文の修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -2,6 +2,8 @@
|
|
2
2
|
|
3
3
|
次の仕事でJavaのJSFを使用する為、[こちら](https://www.wakhok.ac.jp/~tomoharu/jsf2004/text/index_c6.html#doc1_id620)のサイトを使って図書検索システムの作成を行っていますが、以下のエラーを出してしまい、検索結果が表示出来ないので、皆様からご教示を頂きたく、質問させて頂きました。
|
4
4
|
|
5
|
+
netbeansを使って、JSFにMySQLを接続するには、どうすればよろしいでしょうか。
|
6
|
+
|
5
7
|
|
6
8
|
|
7
9
|
#開発環境
|
@@ -576,4 +578,6 @@
|
|
576
578
|
|
577
579
|
|
578
580
|
|
581
|
+
|
582
|
+
|
579
583
|
以上、拙い質問で大変恐縮ですが、宜しくお願い致します。
|