質問編集履歴

2

意図的に内容を抹消する行為にあたるため

2021/05/24 02:06

投稿

syuumainikaku
syuumainikaku

スコア0

test CHANGED
File without changes
test CHANGED
@@ -53,3 +53,135 @@
53
53
  import org.springframework.web.bind.annotation.GetMapping;
54
54
 
55
55
  import org.springframework.web.bind.annotation.PostMapping;
56
+
57
+ @Controller
58
+
59
+ public class TeamController {
60
+
61
+ @Autowired
62
+
63
+ HttpSession session;
64
+
65
+ @GetMapping("/input")
66
+
67
+ public String input() {
68
+
69
+ return "input";
70
+
71
+ }
72
+
73
+ @PostMapping("/team")
74
+
75
+ public String setTeam(Model model) {
76
+
77
+ String[] name= {"佐藤 ","鈴木 ","高橋 ","田中 ",
78
+
79
+ "伊藤 ","渡辺 ","山本 ","中村 ",
80
+
81
+ "小林 ","加藤 ","吉田 ","山田 ",
82
+
83
+ "山口 ","松本 ","井上 ","木村 ",
84
+
85
+ "佐々木","斎藤 ","清水 ","山崎 ",
86
+
87
+ "池田 ","橋本 ","阿部 ","石川 ",
88
+
89
+ "山下 ","中島 ","石井 ","森  ",
90
+
91
+ "小川 ","長谷川","前田 ","岡田 ",
92
+
93
+ "後藤 ","林  ","近藤 ","村上 "};
94
+
95
+ List<Map<String, String>> list = new ArrayList<Map<String, String>>();
96
+
97
+ for(int i = 0; i < name.length; i++) {
98
+
99
+ Map<String, String> map = new HashMap<String, String>();
100
+
101
+ map.put("name", name[i]);
102
+
103
+ list.add(map);
104
+
105
+ }
106
+
107
+ Collections.shuffle(list);
108
+
109
+ model.addAttribute("list", list);
110
+
111
+ return "output";
112
+
113
+ }
114
+
115
+ }
116
+
117
+ ```
118
+
119
+ ```
120
+
121
+ <!--output.html-->
122
+
123
+ <!DOCTYPE html>
124
+
125
+ <html xmlns:th="http://www.thymeleaf.org">
126
+
127
+ <head>
128
+
129
+ <meta charset="UTF-8">
130
+
131
+ <title>抽選完了</title>
132
+
133
+ </head>
134
+
135
+ <body>
136
+
137
+ <span> チームA | チームB | チームC | チームD | チームE | チームF</span>
138
+
139
+ th:if="${ }"
140
+
141
+ <span th:each="str, item:${list}">
142
+
143
+ <span th:text="'&nbsp&nbsp' + ${str.name}"></span>
144
+
145
+ </span>
146
+
147
+ </body>
148
+
149
+ </html>
150
+
151
+ ```
152
+
153
+ ``````
154
+
155
+ <!--input.html -->
156
+
157
+ <!DOCTYPE html>
158
+
159
+ <html xmlns:th="http://www.thymeleaf.org">
160
+
161
+ <head>
162
+
163
+ <meta charset="UTF-8">
164
+
165
+ <title>チーム抽選</title>
166
+
167
+ </head>
168
+
169
+ <body>
170
+
171
+ <form method="post" action="/team">
172
+
173
+ <input type="submit" value="チーム決め">
174
+
175
+ </form>
176
+
177
+ </body>
178
+
179
+ </html>
180
+
181
+ ```
182
+
183
+ 使っているspringのバージョンは2.1.1です。
184
+
185
+ input.htmlのボタンを押すとoutput.htmlにとび、チームの表が出る流れとなっております。
186
+
187
+ 以上、よろしくお願いいたします。

1

誤字の編集

2021/05/24 02:06

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -53,171 +53,3 @@
53
53
  import org.springframework.web.bind.annotation.GetMapping;
54
54
 
55
55
  import org.springframework.web.bind.annotation.PostMapping;
56
-
57
-
58
-
59
- @Controller
60
-
61
- public class TeamController {
62
-
63
-
64
-
65
- @Autowired
66
-
67
- HttpSession session;
68
-
69
-
70
-
71
- @GetMapping("/input")
72
-
73
- public String input() {
74
-
75
- return "input";
76
-
77
- }
78
-
79
-
80
-
81
- @PostMapping("/team")
82
-
83
- public String setTeam(Model model) {
84
-
85
-
86
-
87
- String[] name= {"佐藤 ","鈴木 ","高橋 ","田中 ",
88
-
89
- "伊藤 ","渡辺 ","山本 ","中村 ",
90
-
91
- "小林 ","加藤 ","吉田 ","山田 ",
92
-
93
- "山口 ","松本 ","井上 ","木村 ",
94
-
95
- "佐々木","斎藤 ","清水 ","山崎 ",
96
-
97
- "池田 ","橋本 ","阿部 ","石川 ",
98
-
99
- "山下 ","中島 ","石井 ","森  ",
100
-
101
- "小川 ","長谷川","前田 ","岡田 ",
102
-
103
- "後藤 ","林  ","近藤 ","村上 "};
104
-
105
-
106
-
107
- List<Map<String, String>> list = new ArrayList<Map<String, String>>();
108
-
109
-
110
-
111
- for(int i = 0; i < name.length; i++) {
112
-
113
-
114
-
115
- Map<String, String> map = new HashMap<String, String>();
116
-
117
- map.put("name", name[i]);
118
-
119
- list.add(map);
120
-
121
- }
122
-
123
-
124
-
125
- Collections.shuffle(list);
126
-
127
-
128
-
129
- model.addAttribute("list", list);
130
-
131
-
132
-
133
- return "output";
134
-
135
- }
136
-
137
-
138
-
139
- }
140
-
141
- ```
142
-
143
- ```
144
-
145
- <!--output.html-->
146
-
147
- <!DOCTYPE html>
148
-
149
- <html xmlns:th="http://www.thymeleaf.org">
150
-
151
- <head>
152
-
153
- <meta charset="UTF-8">
154
-
155
- <title>抽選完了</title>
156
-
157
- </head>
158
-
159
- <body>
160
-
161
- <span> チームA | チームB | チームC | チームD | チームE | チームF</span>
162
-
163
- th:if="${ }"
164
-
165
- <span th:each="str, item:${list}">
166
-
167
- <span th:text="'&nbsp&nbsp' + ${str.name}"></span>
168
-
169
- </span>
170
-
171
- </body>
172
-
173
- </html>
174
-
175
-
176
-
177
- ```
178
-
179
- ``````
180
-
181
-
182
-
183
- <!--input.html -->
184
-
185
- <!DOCTYPE html>
186
-
187
- <html xmlns:th="http://www.thymeleaf.org">
188
-
189
- <head>
190
-
191
- <meta charset="UTF-8">
192
-
193
- <title>チーム抽選</title>
194
-
195
- </head>
196
-
197
- <body>
198
-
199
- <form method="post" action="/team">
200
-
201
- <input type="submit" value="チーム決め">
202
-
203
- </form>
204
-
205
- </body>
206
-
207
- </html>
208
-
209
-
210
-
211
- ```
212
-
213
-
214
-
215
-
216
-
217
-
218
-
219
- 使っているspringのバージョンは2.1.1です。
220
-
221
- input.htmlのボタンを押すとoutput.htmlにとび、チームの表が出る流れとなっております。
222
-
223
- 以上、よろしくお願いいたします。