質問編集履歴

4

ソース追加

2018/11/08 03:23

投稿

Nakataku
Nakataku

スコア15

test CHANGED
File without changes
test CHANGED
@@ -58,6 +58,40 @@
58
58
 
59
59
 
60
60
 
61
+
62
+
63
+
64
+
65
+ ```
66
+
67
+ <!DOCTYPE html>
68
+
69
+ <html lang="ja" xmlns:th="http://www.thymeleaf.org">
70
+
71
+ <head>
72
+
73
+ <meta charset="UTF-8">
74
+
75
+ <title>Sign in</title>
76
+
77
+ </head>
78
+
79
+ <body>
80
+
81
+ <h1>login</h1>
82
+
83
+
84
+
85
+ <a href="/signUp">sign up</a>
86
+
87
+
88
+
89
+ </body>
90
+
91
+ </html>
92
+
93
+ ```
94
+
61
95
  ```ここに言語名を入力
62
96
 
63
97
  <!DOCTYPE html>
@@ -94,27 +128,51 @@
94
128
 
95
129
  ```
96
130
 
131
+ @Controller
132
+
133
+ public class SignUpController {
134
+
135
+
136
+
137
+ @RequestMapping(value = "/signUp",method = RequestMethod.GET)
138
+
139
+ public String moveSignUp(Model model){
140
+
141
+ model.addAttribute("name","hogehoge");
142
+
143
+ return "signUp";
144
+
145
+ }
146
+
147
+ @RequestMapping(value = "signUpConfirm", method = RequestMethod.POST)
148
+
149
+ public String signUpConfirm(@ModelAttribute UserInfoForm userInfoForm, Model model){
150
+
151
+ return "signUpConfirm";
152
+
153
+ }
154
+
155
+ }
156
+
157
+ ```
158
+
159
+ ```
160
+
97
161
  <!DOCTYPE html>
98
162
 
99
- <html lang="ja" xmlns:th="http://www.thymeleaf.org">
163
+ <html lang="en">
100
164
 
101
165
  <head>
102
166
 
103
167
  <meta charset="UTF-8">
104
168
 
105
- <title>Sign in</title>
169
+ <title>Sign up Confirm</title>
106
170
 
107
171
  </head>
108
172
 
109
173
  <body>
110
174
 
111
- <h1>login</h1>
175
+ <h1>Sign Up Confirm</h1>
112
-
113
-
114
-
115
- <a href="/signUp">sign up</a>
116
-
117
-
118
176
 
119
177
  </body>
120
178
 
@@ -124,76 +182,40 @@
124
182
 
125
183
  ```
126
184
 
185
+ package dev.create.form;
186
+
187
+
188
+
189
+ import javax.annotation.Resource;
190
+
191
+
192
+
127
- @Controller
193
+ @Resource
128
-
194
+
129
- public class SignUpController {
195
+ public class UserInfoForm {
130
-
131
-
132
-
196
+
197
+
198
+
133
- @RequestMapping(value = "/signUp",method = RequestMethod.GET)
199
+ private String userId = "";
134
-
200
+
201
+
202
+
135
- public String moveSignUp(Model model){
203
+ public String getUserId() {
136
-
137
- model.addAttribute("name","hogehoge");
204
+
138
-
139
- return "signUp";
205
+ return userId;
140
-
206
+
141
- }
207
+ }
142
-
143
- @RequestMapping(value = "signUpConfirm", method = RequestMethod.POST)
208
+
144
-
209
+
210
+
145
- public String signUpConfirm(@ModelAttribute UserInfoForm userInfoForm, Model model){
211
+ public void setUserId(String userId) {
146
-
212
+
147
- return "signUpConfirm";
213
+ this.userId = userId;
148
-
214
+
149
- }
215
+ }
216
+
217
+
150
218
 
151
219
  }
152
220
 
153
221
  ```
154
-
155
- ```
156
-
157
-
158
-
159
- ```
160
-
161
- ```
162
-
163
- package dev.create.form;
164
-
165
-
166
-
167
- import javax.annotation.Resource;
168
-
169
-
170
-
171
- @Resource
172
-
173
- public class UserInfoForm {
174
-
175
-
176
-
177
- private String userId = "";
178
-
179
-
180
-
181
- public String getUserId() {
182
-
183
- return userId;
184
-
185
- }
186
-
187
-
188
-
189
- public void setUserId(String userId) {
190
-
191
- this.userId = userId;
192
-
193
- }
194
-
195
-
196
-
197
- }
198
-
199
- ```

3

ソース修正

2018/11/08 03:23

投稿

Nakataku
Nakataku

スコア15

test CHANGED
File without changes
test CHANGED
@@ -140,79 +140,21 @@
140
140
 
141
141
  }
142
142
 
143
+ @RequestMapping(value = "signUpConfirm", method = RequestMethod.POST)
144
+
145
+ public String signUpConfirm(@ModelAttribute UserInfoForm userInfoForm, Model model){
146
+
147
+ return "signUpConfirm";
148
+
149
+ }
150
+
143
151
  }
144
152
 
145
153
  ```
146
154
 
147
155
  ```
148
156
 
149
- buildscript {
150
157
 
151
- ext {
152
-
153
- springBootVersion = '2.1.0.RELEASE'
154
-
155
- }
156
-
157
- repositories {
158
-
159
- mavenCentral()
160
-
161
- }
162
-
163
- dependencies {
164
-
165
- classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
166
-
167
- }
168
-
169
- }
170
-
171
-
172
-
173
- apply plugin: 'java'
174
-
175
- apply plugin: 'eclipse'
176
-
177
- apply plugin: 'org.springframework.boot'
178
-
179
- apply plugin: 'io.spring.dependency-management'
180
-
181
-
182
-
183
- group = 'div.create-resume'
184
-
185
- version = '0.0.1-SNAPSHOT'
186
-
187
- sourceCompatibility = 11
188
-
189
-
190
-
191
- repositories {
192
-
193
- mavenCentral()
194
-
195
- }
196
-
197
-
198
-
199
-
200
-
201
- dependencies {
202
-
203
- implementation('org.springframework.boot:spring-boot-starter-mail')
204
-
205
- implementation('org.springframework.boot:spring-boot-starter-thymeleaf')
206
-
207
- implementation('org.springframework.boot:spring-boot-starter-web')
208
-
209
- runtimeOnly('org.springframework.boot:spring-boot-devtools')
210
-
211
- runtimeOnly('mysql:mysql-connector-java')
212
-
213
- testImplementation('org.springframework.boot:spring-boot-starter-test')
214
-
215
- }
216
158
 
217
159
  ```
218
160
 

2

エラーメッセージ、formの追加

2018/11/08 03:21

投稿

Nakataku
Nakataku

スコア15

test CHANGED
File without changes
test CHANGED
@@ -18,107 +18,37 @@
18
18
 
19
19
  at org.thymeleaf.templateparser.markup.AbstractMarkupTemplateParser.parseStandalone(AbstractMarkupTemplateParser.java:100) ~[thymeleaf-3.0.11.RELEASE.jar:3.0.11.RELEASE]
20
20
 
21
- at org.thymeleaf.engine.TemplateManager.parseAndProcess(TemplateManager.java:666) ~[thymeleaf-3.0.11.RELEASE.jar:3.0.11.RELEASE]
22
-
23
- at org.thymeleaf.TemplateEngine.process(TemplateEngine.java:1098) ~[thymeleaf-3.0.11.RELEASE.jar:3.0.11.RELEASE]
24
-
25
- at org.thymeleaf.TemplateEngine.process(TemplateEngine.java:1072) ~[thymeleaf-3.0.11.RELEASE.jar:3.0.11.RELEASE]
26
-
27
- at org.thymeleaf.spring5.view.ThymeleafView.renderFragment(ThymeleafView.java:362) ~[thymeleaf-spring5-3.0.11.RELEASE.jar:3.0.11.RELEASE]
28
-
29
- at org.thymeleaf.spring5.view.ThymeleafView.render(ThymeleafView.java:189) ~[thymeleaf-spring5-3.0.11.RELEASE.jar:3.0.11.RELEASE]
30
-
31
- at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1370) ~[spring-webmvc-5.1.2.RELEASE.jar:5.1.2.RELEASE]
32
-
33
- at org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1116) ~[spring-webmvc-5.1.2.RELEASE.jar:5.1.2.RELEASE]
34
-
35
- at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1055) ~[spring-webmvc-5.1.2.RELEASE.jar:5.1.2.RELEASE]
36
-
37
- at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:942) ~[spring-webmvc-5.1.2.RELEASE.jar:5.1.2.RELEASE]
38
-
39
- at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:998) ~[spring-webmvc-5.1.2.RELEASE.jar:5.1.2.RELEASE]
40
-
41
- at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:890) ~[spring-webmvc-5.1.2.RELEASE.jar:5.1.2.RELEASE]
42
-
43
- at javax.servlet.http.HttpServlet.service(HttpServlet.java:634) ~[tomcat-embed-core-9.0.12.jar:9.0.12]
44
-
45
- at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:875) ~[spring-webmvc-5.1.2.RELEASE.jar:5.1.2.RELEASE]
46
-
47
- at javax.servlet.http.HttpServlet.service(HttpServlet.java:741) ~[tomcat-embed-core-9.0.12.jar:9.0.12]
48
-
49
- at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) ~[tomcat-embed-core-9.0.12.jar:9.0.12]
50
-
51
- at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.12.jar:9.0.12]
52
-
53
- at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) ~[tomcat-embed-websocket-9.0.12.jar:9.0.12]
54
-
55
- at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.12.jar:9.0.12]
56
-
57
- at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.12.jar:9.0.12]
58
-
59
- at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99) ~[spring-web-5.1.2.RELEASE.jar:5.1.2.RELEASE]
60
-
61
- at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-5.1.2.RELEASE.jar:5.1.2.RELEASE]
62
-
63
- at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.12.jar:9.0.12]
64
-
65
- at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.12.jar:9.0.12]
66
-
67
- at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:92) ~[spring-web-5.1.2.RELEASE.jar:5.1.2.RELEASE]
68
-
69
- at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-5.1.2.RELEASE.jar:5.1.2.RELEASE]
70
-
71
- at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.12.jar:9.0.12]
72
-
73
- at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.12.jar:9.0.12]
74
-
75
- at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:93) ~[spring-web-5.1.2.RELEASE.jar:5.1.2.RELEASE]
76
-
77
- at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-5.1.2.RELEASE.jar:5.1.2.RELEASE]
78
-
79
- at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.12.jar:9.0.12]
80
-
81
- at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.12.jar:9.0.12]
82
-
83
- at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:200) ~[spring-web-5.1.2.RELEASE.jar:5.1.2.RELEASE]
84
-
85
- at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-5.1.2.RELEASE.jar:5.1.2.RELEASE]
86
-
87
- at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.12.jar:9.0.12]
88
-
89
- at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.12.jar:9.0.12]
90
-
91
- at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199) ~[tomcat-embed-core-9.0.12.jar:9.0.12]
92
-
93
- at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) ~[tomcat-embed-core-9.0.12.jar:9.0.12]
94
-
95
- at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:490) ~[tomcat-embed-core-9.0.12.jar:9.0.12]
96
-
97
- at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139) ~[tomcat-embed-core-9.0.12.jar:9.0.12]
98
-
99
- at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) ~[tomcat-embed-core-9.0.12.jar:9.0.12]
100
-
101
- at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74) ~[tomcat-embed-core-9.0.12.jar:9.0.12]
102
-
103
- at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) ~[tomcat-embed-core-9.0.12.jar:9.0.12]
104
-
105
- at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408) ~[tomcat-embed-core-9.0.12.jar:9.0.12]
106
-
107
- at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) ~[tomcat-embed-core-9.0.12.jar:9.0.12]
108
-
109
- at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:770) ~[tomcat-embed-core-9.0.12.jar:9.0.12]
110
-
111
- at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1415) ~[tomcat-embed-core-9.0.12.jar:9.0.12]
112
-
113
- at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) ~[tomcat-embed-core-9.0.12.jar:9.0.12]
114
-
115
- at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) ~[na:na]
116
-
117
- at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) ~[na:na]
118
-
119
- at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) ~[tomcat-embed-core-9.0.12.jar:9.0.12]
120
-
121
- at java.base/java.lang.Thread.run(Thread.java:834) ~[na:na]
21
+ ```
22
+
23
+ ```
24
+
25
+ Caused by: org.attoparser.ParseException: Error during execution of processor 'org.thymeleaf.spring5.processor.SpringInputGeneralFieldTagProcessor' (template: "signUp" - line 9, col 28)
26
+
27
+ at org.attoparser.MarkupParser.parseDocument(MarkupParser.java:393) ~[attoparser-2.0.5.RELEASE.jar:2.0.5.RELEASE]
28
+
29
+ at org.attoparser.MarkupParser.parse(MarkupParser.java:257) ~[attoparser-2.0.5.RELEASE.jar:2.0.5.RELEASE]
30
+
31
+ at org.thymeleaf.templateparser.markup.AbstractMarkupTemplateParser.parse(AbstractMarkupTemplateParser.java:230) ~[thymeleaf-3.0.11.RELEASE.jar:3.0.11.RELEASE]
32
+
33
+ ... 52 common frames omitted
34
+
35
+ ```
36
+
37
+ ```
38
+
39
+ Caused by: org.thymeleaf.exceptions.TemplateProcessingException: Error during execution of processor 'org.thymeleaf.spring5.processor.SpringInputGeneralFieldTagProcessor' (template: "signUp" - line 9, col 28)
40
+
41
+ at org.thymeleaf.processor.element.AbstractAttributeTagProcessor.doProcess(AbstractAttributeTagProcessor.java:117) ~[thymeleaf-3.0.11.RELEASE.jar:3.0.11.RELEASE]
42
+
43
+ at org.thymeleaf.processor.element.AbstractElementTagProcessor.process(AbstractElementTagProcessor.java:95) ~[thymeleaf-3.0.11.RELEASE.jar:3.0.11.RELEASE]
44
+
45
+ ```
46
+
47
+
48
+
49
+ ```
50
+
51
+ Caused by: java.lang.IllegalStateException: Neither BindingResult nor plain target object for bean name 'userInfoForm' available as request attribute
122
52
 
123
53
  ```
124
54
 
@@ -285,3 +215,43 @@
285
215
  }
286
216
 
287
217
  ```
218
+
219
+ ```
220
+
221
+ package dev.create.form;
222
+
223
+
224
+
225
+ import javax.annotation.Resource;
226
+
227
+
228
+
229
+ @Resource
230
+
231
+ public class UserInfoForm {
232
+
233
+
234
+
235
+ private String userId = "";
236
+
237
+
238
+
239
+ public String getUserId() {
240
+
241
+ return userId;
242
+
243
+ }
244
+
245
+
246
+
247
+ public void setUserId(String userId) {
248
+
249
+ this.userId = userId;
250
+
251
+ }
252
+
253
+
254
+
255
+ }
256
+
257
+ ```

1

gradleファイルもあげました

2018/11/08 02:56

投稿

Nakataku
Nakataku

スコア15

test CHANGED
File without changes
test CHANGED
@@ -213,3 +213,75 @@
213
213
  }
214
214
 
215
215
  ```
216
+
217
+ ```
218
+
219
+ buildscript {
220
+
221
+ ext {
222
+
223
+ springBootVersion = '2.1.0.RELEASE'
224
+
225
+ }
226
+
227
+ repositories {
228
+
229
+ mavenCentral()
230
+
231
+ }
232
+
233
+ dependencies {
234
+
235
+ classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
236
+
237
+ }
238
+
239
+ }
240
+
241
+
242
+
243
+ apply plugin: 'java'
244
+
245
+ apply plugin: 'eclipse'
246
+
247
+ apply plugin: 'org.springframework.boot'
248
+
249
+ apply plugin: 'io.spring.dependency-management'
250
+
251
+
252
+
253
+ group = 'div.create-resume'
254
+
255
+ version = '0.0.1-SNAPSHOT'
256
+
257
+ sourceCompatibility = 11
258
+
259
+
260
+
261
+ repositories {
262
+
263
+ mavenCentral()
264
+
265
+ }
266
+
267
+
268
+
269
+
270
+
271
+ dependencies {
272
+
273
+ implementation('org.springframework.boot:spring-boot-starter-mail')
274
+
275
+ implementation('org.springframework.boot:spring-boot-starter-thymeleaf')
276
+
277
+ implementation('org.springframework.boot:spring-boot-starter-web')
278
+
279
+ runtimeOnly('org.springframework.boot:spring-boot-devtools')
280
+
281
+ runtimeOnly('mysql:mysql-connector-java')
282
+
283
+ testImplementation('org.springframework.boot:spring-boot-starter-test')
284
+
285
+ }
286
+
287
+ ```