質問編集履歴
3
依頼のあったコードを掲示しました。
title
CHANGED
File without changes
|
body
CHANGED
@@ -33,6 +33,7 @@
|
|
33
33
|
import org.springframework.web.servlet.ModelAndView;
|
34
34
|
import org.springframework.beans.factory.annotation.Autowired;
|
35
35
|
|
36
|
+
|
36
37
|
import java.util.Optional;
|
37
38
|
|
38
39
|
import javax.annotation.PostConstruct;
|
@@ -136,7 +137,7 @@
|
|
136
137
|
d1.setName("tuyano");
|
137
138
|
d1.setAge(123);
|
138
139
|
d1.setMail("syoda@tuyano");
|
139
|
-
d1.setMemo("
|
140
|
+
d1.setMemo("09099994444");
|
140
141
|
repository.saveAndFlush(d1);
|
141
142
|
|
142
143
|
//2つ目のデータ作成
|
@@ -144,7 +145,7 @@
|
|
144
145
|
d2.setName("naoki");
|
145
146
|
d2.setAge(23);
|
146
147
|
d2.setMail("gorilla227naoki@gmail.com");
|
147
|
-
d2.setMemo("
|
148
|
+
d2.setMemo("070498394222");
|
148
149
|
repository.saveAndFlush(d2);
|
149
150
|
|
150
151
|
//3つ目のデータ作成
|
@@ -153,14 +154,13 @@
|
|
153
154
|
d3.setName("sachiko");
|
154
155
|
d3.setAge(14);
|
155
156
|
d3.setMail("sachiko@happy");
|
156
|
-
d3.setMemo("
|
157
|
+
d3.setMemo("09099996767");
|
157
158
|
repository.saveAndFlush(d3);
|
158
159
|
|
159
160
|
}
|
160
161
|
|
161
162
|
}
|
162
163
|
|
163
|
-
|
164
164
|
```
|
165
165
|
|
166
166
|
|
@@ -183,6 +183,7 @@
|
|
183
183
|
tr{margin:5px;}
|
184
184
|
th{padding:5px; color:white; background:darkgray;}
|
185
185
|
td{padding:5px; color:black; background:#f0f0f0f;}
|
186
|
+
.err{color:red;}
|
186
187
|
</style>
|
187
188
|
</head>
|
188
189
|
|
@@ -210,10 +211,9 @@
|
|
210
211
|
<div th:if="${#fields.hasErrors('mail')}" th:errors="*{mail}" th:errorclass="err"></div></td>
|
211
212
|
</tr>
|
212
213
|
<tr>
|
213
|
-
<td><label for="memo">メモ</label></td>
|
214
|
+
<td><label for="memo">メモ</label></td>
|
214
|
-
<td>
|
215
|
-
<textarea name="memo" th:value="*{memo}" cols="20" rows="5"></textarea>
|
215
|
+
<td><textarea name="memo" th:value="*{memo}" cols="20" rows="5"></textarea>
|
216
|
-
</td>
|
216
|
+
<div th:if="${#fields.hasErrors('memo')}" th:errors="*{memo}" th:errorclass="err"></div></td>
|
217
217
|
</tr><td></td><tr>
|
218
218
|
<td>
|
219
219
|
<input type="submit"/>
|
@@ -236,11 +236,74 @@
|
|
236
236
|
</html>
|
237
237
|
```
|
238
238
|
|
239
|
+
messages.properties
|
240
|
+
```
|
241
|
+
content.title=this is sample page!
|
242
|
+
```
|
243
|
+
pom.xml
|
244
|
+
```xml
|
245
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
246
|
+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
247
|
+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
248
|
+
<modelVersion>4.0.0</modelVersion>
|
249
|
+
<parent>
|
250
|
+
<groupId>org.springframework.boot</groupId>
|
251
|
+
<artifactId>spring-boot-starter-parent</artifactId>
|
252
|
+
<version>2.1.7.RELEASE</version>
|
253
|
+
<relativePath/> <!-- lookup parent from repository -->
|
254
|
+
</parent>
|
255
|
+
<groupId>com.tuyano.springboot</groupId>
|
256
|
+
<artifactId>MyBootApp</artifactId>
|
257
|
+
<version>0.0.1-SNAPSHOT</version>
|
258
|
+
<name>MyBootApp</name>
|
259
|
+
<description>Sample project for Spring Boot</description>
|
239
260
|
|
261
|
+
<properties>
|
262
|
+
<java.version>1.8</java.version>
|
263
|
+
</properties>
|
240
264
|
|
265
|
+
<dependencies>
|
266
|
+
<dependency>
|
267
|
+
<groupId>org.springframework.boot</groupId>
|
268
|
+
<artifactId>spring-boot-starter-data-jpa</artifactId>
|
269
|
+
</dependency>
|
270
|
+
<dependency>
|
271
|
+
<groupId>org.springframework.boot</groupId>
|
272
|
+
<artifactId>spring-boot-starter-web</artifactId>
|
273
|
+
</dependency>
|
241
274
|
|
275
|
+
<dependency>
|
276
|
+
<groupId>com.h2database</groupId>
|
277
|
+
<artifactId>h2</artifactId>
|
278
|
+
<scope>runtime</scope>
|
279
|
+
</dependency>
|
280
|
+
<dependency>
|
281
|
+
<groupId>org.springframework.boot</groupId>
|
282
|
+
<artifactId>spring-boot-starter-test</artifactId>
|
283
|
+
<scope>test</scope>
|
284
|
+
</dependency>
|
285
|
+
<dependency>
|
286
|
+
<groupId>org.springframework.boot</groupId>
|
287
|
+
<artifactId>spring-boot-starter-thymeleaf</artifactId>
|
288
|
+
</dependency>
|
289
|
+
</dependencies>
|
242
290
|
|
291
|
+
<build>
|
292
|
+
<plugins>
|
293
|
+
<plugin>
|
294
|
+
<groupId>org.springframework.boot</groupId>
|
295
|
+
<artifactId>spring-boot-maven-plugin</artifactId>
|
296
|
+
</plugin>
|
297
|
+
</plugins>
|
298
|
+
</build>
|
243
299
|
|
300
|
+
</project>
|
244
301
|
|
302
|
+
```
|
245
303
|
|
304
|
+
構成
|
305
|
+
](9d6af98677ba790beabe4f78c376740c.png)
|
306
|
+
|
307
|
+
|
308
|
+
|
246
309
|
### 補足情報(FW/ツールのバージョンなど)
|
2
タグを追加しました。
title
CHANGED
File without changes
|
body
CHANGED
File without changes
|
1
タイプミスを訂正しました。
title
CHANGED
File without changes
|
body
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
Spring Bootの学習をしている初学者です。
|
4
4
|
|
5
5
|
テキストを用いて学習をしているのですが、
|
6
|
-
mavenベースのプロジェクトでプロパティファイルmessages_ja.
|
6
|
+
mavenベースのプロジェクトでプロパティファイルmessages_ja.propertiesからテキストを読み込んで、表示しようとしています。
|
7
7
|
|
8
8
|
ですが、画像のようにプロパティファイルを作成して、htmlにメッセージ式を入力しても、うまく表示がされません。(??content.title_ja??の部分にテキストを表示したいです。)
|
9
9
|
|