質問編集履歴

3

訂正のため

2022/10/15 07:06

投稿

ooood
ooood

スコア2

test CHANGED
File without changes
test CHANGED
@@ -14,11 +14,13 @@
14
14
  ```Java
15
15
  import java.sql.PreparedStatement;
16
16
  import java.sql.ResultSet;
17
+ import java.text.DecimalFormat;
17
18
  import java.util.ArrayList;
18
19
 
19
20
  import list.ListBean;
20
21
  public class ListDao extends DBAccess {
21
22
 
23
+ @SuppressWarnings("unused")
22
24
  public ArrayList<ListBean> getUserList() {
23
25
 
24
26
  ArrayList<ListBean> list = new ArrayList<ListBean>();
@@ -46,15 +48,22 @@
46
48
 
47
49
 
48
50
  list.add(bean);
51
+
52
+ DecimalFormat objFmt=new DecimalFormat("###,###");
49
53
  }
50
54
 
51
55
  } catch (Exception e) {
52
56
  e.printStackTrace();
57
+ }
58
+
53
- } finally {
59
+ finally {
54
60
  disconnect();
55
61
  }
56
62
  return list;
57
63
  }
64
+
65
+ }
66
+
58
67
  ```
59
68
  ```jsp
60
69
 
@@ -92,7 +101,7 @@
92
101
  <td><%= list.get(i).getName() %></td>
93
102
  <td><%= list.get(i).getTypename() %></td>
94
103
  <td><%= list.get(i).getPostname() %></td>
95
- <td style="text-align:right;"><%= list.get(i).getSalary() %></td>
104
+ <td style="text-align:right;"><%= objFmt.format(list.get(i).getSalary()) %></td>
96
105
 
97
106
  </tr>
98
107
  <% } %>

2

情報不足のため

2022/10/15 05:23

投稿

ooood
ooood

スコア2

test CHANGED
File without changes
test CHANGED
@@ -56,8 +56,51 @@
56
56
  return list;
57
57
  }
58
58
  ```
59
+ ```jsp
60
+
61
+ <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
62
+ <%@ page import="java.util.*"%>
63
+ <%@ page import="list.ListBean" %>
59
64
 
60
65
 
66
+ <html>
67
+ <head>
68
+ <title>社員一覧画面</title>
69
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
70
+
71
+ </head>
72
+ <body>
73
+ <%
74
+ ArrayList<list.ListBean> list =(ArrayList<list.ListBean>)request.getAttribute("list");
75
+ %>
76
+
77
+ <div style="text-align:center;">
78
+ <h2>社員一覧</h2>
79
+ <table align="center" border="1" style="border-collapse: collapse; border-color: black; width: 500;">
80
+ <tr>
81
+ <td style="background-color: #cccccc;">ID</td>
82
+ <td style="background-color: #cccccc;">氏名</td>
83
+ <td style="background-color: #cccccc;">職種</td>
84
+ <td style="background-color: #cccccc;">役職</td>
85
+ <td style="background-color: #cccccc;">給与</td>
86
+
87
+ </tr>
88
+
89
+ <% for(int i=0; i<list.size();i++){ %>
90
+ <tr align="center">
91
+ <td><%= list.get(i).getId() %></td>
92
+ <td><%= list.get(i).getName() %></td>
93
+ <td><%= list.get(i).getTypename() %></td>
94
+ <td><%= list.get(i).getPostname() %></td>
95
+ <td style="text-align:right;"><%= list.get(i).getSalary() %></td>
96
+
97
+ </tr>
98
+ <% } %>
99
+ </table>
100
+ </div>
101
+ </body>
102
+ </html>
103
+ ```
61
104
  | emp_id | emp_name | type_name | post_name | salary |
62
105
  +--------+------------+-----------+-----------+--------+
63
106
  | 10001 | ffffff | vvv部 | hhhhh | 100000 |

1

情報不足のため

2022/10/14 12:04

投稿

ooood
ooood

スコア2

test CHANGED
File without changes
test CHANGED
@@ -58,4 +58,11 @@
58
58
  ```
59
59
 
60
60
 
61
+ | emp_id | emp_name | type_name | post_name | salary |
62
+ +--------+------------+-----------+-----------+--------+
63
+ | 10001 | ffffff | vvv部 | hhhhh | 100000 |
61
64
 
65
+
66
+ | emp_id | emp_name | type_name | post_name | salary |
67
+ +--------+------------+-----------+-----------+--------+
68
+ | 10001 | ffffff | vvv部 | hhhhh | 100,000 |