質問編集履歴

3

質問にソースコードの追加

2017/09/21 01:54

投稿

xxxAIxxx
xxxAIxxx

スコア13

test CHANGED
File without changes
test CHANGED
@@ -123,3 +123,333 @@
123
123
  情報: Server startup in 19190 ms [木 9 21 10:29:57 JST 2017]
124
124
 
125
125
  ```
126
+
127
+
128
+
129
+ ▼WelcomeController.java▼
130
+
131
+ ```
132
+
133
+ package example.app;
134
+
135
+
136
+
137
+ import org.springframework.stereotype.Controller;
138
+
139
+ import org.springframework.web.bind.annotation.RequestMapping;
140
+
141
+
142
+
143
+ @Controller
144
+
145
+ public class WelcomeController{
146
+
147
+
148
+
149
+ @RequestMapping("/")
150
+
151
+ public String home() {
152
+
153
+
154
+
155
+ return "index";
156
+
157
+
158
+
159
+ }
160
+
161
+
162
+
163
+ }
164
+
165
+ ```
166
+
167
+ ▼web.xml▼
168
+
169
+ ```
170
+
171
+ <?xml version="1.0" encoding="UTF-8" ?>
172
+
173
+ <web-app xmlns="http://java.sun.com/xml/ns/javaee"
174
+
175
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
176
+
177
+ xsi:schemaLocation="
178
+
179
+ http://java.sun.com/xml/ns/javaee
180
+
181
+ http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd
182
+
183
+ "
184
+
185
+ version="3.0">
186
+
187
+
188
+
189
+ <jsp-config>
190
+
191
+ <jsp-property-group>
192
+
193
+ <url-pattern>*.jsp</url-pattern>
194
+
195
+ <page-encoding>UTF-8</page-encoding>
196
+
197
+ <include-prelude>/WEB-INF/include.jsp</include-prelude>
198
+
199
+ </jsp-property-group>
200
+
201
+ </jsp-config>
202
+
203
+
204
+
205
+ <listener>
206
+
207
+ <listener-class>
208
+
209
+ org.springframework.web.cotext.ContextLoaderListener
210
+
211
+ </listener-class>
212
+
213
+ </listener>
214
+
215
+ <context-param>
216
+
217
+ <param-name>contextClass</param-name>
218
+
219
+ <param-value>
220
+
221
+ org.springframework.web.context.support.AnnotationConfigWebApplicationContext
222
+
223
+ </param-value>
224
+
225
+ </context-param>
226
+
227
+ <context-param>
228
+
229
+ <param-name>contextConfigLocation</param-name>
230
+
231
+ <param-value>example.config.AppConfig</param-value>
232
+
233
+ </context-param>
234
+
235
+ <servlet>
236
+
237
+ <servlet-name>app</servlet-name>
238
+
239
+ <servlet-class>
240
+
241
+ org.springframework.web.servlet.DispatcherServlet
242
+
243
+ </servlet-class>
244
+
245
+ <init-param>
246
+
247
+ <param-name>contextClass</param-name>
248
+
249
+ <param-value>
250
+
251
+ org.springframework.web.context.support.AnnotationConfigWebApplicationContext
252
+
253
+ </param-value>
254
+
255
+ </init-param>
256
+
257
+ <init-param>
258
+
259
+ <param-name>contextConfigLocation</param-name>
260
+
261
+ <param-value>example.config.WebMvc.Config</param-value>
262
+
263
+ </init-param>
264
+
265
+ <load-on-startup>1</load-on-startup>
266
+
267
+ </servlet>
268
+
269
+
270
+
271
+ <servlet-mapping>
272
+
273
+ <servlet-name>app</servlet-name>
274
+
275
+ <url-pattern>/</url-pattern>
276
+
277
+ </servlet-mapping>
278
+
279
+ <filter>
280
+
281
+ <filter-name>CharacterEncodingFilter</filter-name>
282
+
283
+ <filter-class>
284
+
285
+ org.springframework.web.filter.CharacterEncodingFilter
286
+
287
+ </filter-class>
288
+
289
+ <init-param>
290
+
291
+ <param-name>encoding</param-name>
292
+
293
+ <param-value>UTF-8</param-value>
294
+
295
+ </init-param>
296
+
297
+ <init-param>
298
+
299
+ <param-name>forceEncoding</param-name>
300
+
301
+ <param-value>true</param-value>
302
+
303
+ </init-param>
304
+
305
+ </filter>
306
+
307
+ <filter-mapping>
308
+
309
+ <filter-name>CharacterEncodingFilter</filter-name>
310
+
311
+ <url-pattern>/*</url-pattern>
312
+
313
+ </filter-mapping>
314
+
315
+ </web-app>
316
+
317
+ ```
318
+
319
+
320
+
321
+ ▼pom.xml▼
322
+
323
+ ```
324
+
325
+ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
326
+
327
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
328
+
329
+ <modelVersion>4.0.0</modelVersion>
330
+
331
+ <groupId>example</groupId>
332
+
333
+ <artifactId>firstapp</artifactId>
334
+
335
+ <packaging>war</packaging>
336
+
337
+ <version>0.0.1-SNAPSHOT</version>
338
+
339
+ <name>firstapp Maven Webapp</name>
340
+
341
+ <url>http://maven.apache.org</url>
342
+
343
+
344
+
345
+ <dependencyManagement>
346
+
347
+ <dependencies>
348
+
349
+ <dependency>
350
+
351
+ <groupId>io.spring.platform</groupId>
352
+
353
+ <artifactId>platform-bom</artifactId>
354
+
355
+ <version>2.0.5.RELEASE</version>
356
+
357
+ <type>pom</type>
358
+
359
+ <scope>import</scope>
360
+
361
+ </dependency>
362
+
363
+ </dependencies>
364
+
365
+ </dependencyManagement>
366
+
367
+
368
+
369
+ <dependencies>
370
+
371
+ <dependency>
372
+
373
+ <groupId>javax.servlet</groupId>
374
+
375
+ <artifactId>javax.servlet-api</artifactId>
376
+
377
+ <scope>provided</scope>
378
+
379
+ </dependency>
380
+
381
+ <dependency>
382
+
383
+ <groupId>org.apache.taglibs</groupId>
384
+
385
+ <artifactId>taglibs-standard-jstlel</artifactId>
386
+
387
+ </dependency>
388
+
389
+ <dependency>
390
+
391
+ <groupId>org.springframework</groupId>
392
+
393
+ <artifactId>spring-webmvc</artifactId>
394
+
395
+ </dependency>
396
+
397
+ <dependency>
398
+
399
+ <groupId>org.hibernate</groupId>
400
+
401
+ <artifactId>hibernate-validator</artifactId>
402
+
403
+ </dependency>
404
+
405
+ <dependency>
406
+
407
+ <groupId>org.slf4j</groupId>
408
+
409
+ <artifactId>jcl-over-slf4j</artifactId>
410
+
411
+ </dependency>
412
+
413
+ <dependency>
414
+
415
+ <groupId>ch.qos.logback</groupId>
416
+
417
+ <artifactId>logback-classic</artifactId>
418
+
419
+ </dependency>
420
+
421
+ </dependencies>
422
+
423
+
424
+
425
+ <build>
426
+
427
+ <finalName>firstapp</finalName>
428
+
429
+ <pluginManagement>
430
+
431
+ <plugins>
432
+
433
+ <plugin>
434
+
435
+ <artifactId>maven-compiler-plugin</artifactId>
436
+
437
+ <configuration>
438
+
439
+ <source>1.8</source>
440
+
441
+ <target>1.8</target>
442
+
443
+ </configuration>
444
+
445
+ </plugin>
446
+
447
+ </plugins>
448
+
449
+ </pluginManagement>
450
+
451
+ </build>
452
+
453
+ </project>
454
+
455
+ ```

2

質問内容の編集

2017/09/21 01:54

投稿

xxxAIxxx
xxxAIxxx

スコア13

test CHANGED
File without changes
test CHANGED
@@ -7,6 +7,8 @@
7
7
  サーバーで起動したところ404エラー出てしまいました。
8
8
 
9
9
 
10
+
11
+ 404エラーを解消し、正常にページを表示させたいです。
10
12
 
11
13
  どうぞよろしくお願いいたします。
12
14
 

1

初心者アイコンの設定

2017/09/21 01:46

投稿

xxxAIxxx
xxxAIxxx

スコア13

test CHANGED
File without changes
test CHANGED
File without changes