{"id":209,"date":"2019-07-02T10:33:16","date_gmt":"2019-07-02T01:33:16","guid":{"rendered":"http:\/\/2019se3.satoshis.jp\/?p=209"},"modified":"2019-07-02T13:03:24","modified_gmt":"2019-07-02T04:03:24","slug":"7%e6%9c%882%e6%97%a5","status":"publish","type":"post","link":"https:\/\/2019se3.satoshis.jp\/?p=209","title":{"rendered":"7\u67082\u65e5"},"content":{"rendered":"<h3>\u30df\u30e5\u30fc\u30b8\u30c3\u30af\u30d7\u30ec\u30a4\u30e4\u30fc\u306eWeb\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u4f5c\u3063\u3066\u307f\u308b<\/h3>\n<p>\u4ee5\u524d\u3001Java\u30b3\u30f3\u30bd\u30fc\u30eb\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3068\u3057\u3066MusicPlayer\u3092\u4f5c\u6210\u3057\u305f\u304c\u3001\u4eca\u56de\u306f\u3001\u305d\u308c\u3092SpringBoot\u3092\u4f7f\u7528\u3057\u305fWeb\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3068\u3057\u3066\u4f5c\u6210\u3057\u3066\u307f\u308b\u3002<\/p>\n<p>\u307e\u305a\u306f\u65b0\u898f\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3092\u4f5c\u6210\u3059\u308b\u3002<\/p>\n<p>\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u540d\u306f\u597d\u304d\u306a\u3088\u3046\u306b\u6c7a\u3081\u3066\u3088\u3044\u3002<\/p>\n<p>pom.xml \u3067 SpringBoot \u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u3092\u5909\u66f4\u3059\u308b\u3002<br \/>\n\u30c7\u30d5\u30a9\u30eb\u30c8\u3067\u306f2.1.6\u306b\u306a\u3063\u3066\u3044\u308b\u304c\u3001\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3059\u308b\u306e\u3067\u3001\u3053\u308c\u307e\u3067\u306b\u4f7f\u3063\u3066\u3044\u305f2.1.4\u306b\u3059\u308b\u3002<br \/>\n\u305d\u3057\u3066\u3001Thymeleaf\u3068JPA\u3068HSQLDB\u306e\u4f9d\u5b58\u95a2\u4fc2\u3082\u8ffd\u52a0\u3057\u3066\u304a\u304f\u3002<\/p>\n<pre class=\"brush: xml; highlight: [8,33,34,35,36,37,38,39,40,41,42,43,44,45,46]; title: ; notranslate\" title=\"\">\r\n&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;\r\n&lt;project xmlns=&quot;http:\/\/maven.apache.org\/POM\/4.0.0&quot; xmlns:xsi=&quot;http:\/\/www.w3.org\/2001\/XMLSchema-instance&quot;\r\n\txsi:schemaLocation=&quot;http:\/\/maven.apache.org\/POM\/4.0.0 http:\/\/maven.apache.org\/xsd\/maven-4.0.0.xsd&quot;&gt;\r\n\t&lt;modelVersion&gt;4.0.0&lt;\/modelVersion&gt;\r\n\t&lt;parent&gt;\r\n\t\t&lt;groupId&gt;org.springframework.boot&lt;\/groupId&gt;\r\n\t\t&lt;artifactId&gt;spring-boot-starter-parent&lt;\/artifactId&gt;\r\n\t\t&lt;version&gt;2.1.4.RELEASE&lt;\/version&gt;\r\n\t\t&lt;relativePath\/&gt; &lt;!-- lookup parent from repository --&gt;\r\n\t&lt;\/parent&gt;\r\n\t&lt;groupId&gt;jp.abc&lt;\/groupId&gt;\r\n\t&lt;artifactId&gt;stunes&lt;\/artifactId&gt;\r\n\t&lt;version&gt;0.0.1-SNAPSHOT&lt;\/version&gt;\r\n\t&lt;name&gt;stunes&lt;\/name&gt;\r\n\t&lt;description&gt;Demo project for Spring Boot&lt;\/description&gt;\r\n\r\n\t&lt;properties&gt;\r\n\t\t&lt;java.version&gt;1.8&lt;\/java.version&gt;\r\n\t&lt;\/properties&gt;\r\n\r\n\t&lt;dependencies&gt;\r\n\t\t&lt;dependency&gt;\r\n\t\t\t&lt;groupId&gt;org.springframework.boot&lt;\/groupId&gt;\r\n\t\t\t&lt;artifactId&gt;spring-boot-starter-web&lt;\/artifactId&gt;\r\n\t\t&lt;\/dependency&gt;\r\n\r\n\t\t&lt;dependency&gt;\r\n\t\t\t&lt;groupId&gt;org.springframework.boot&lt;\/groupId&gt;\r\n\t\t\t&lt;artifactId&gt;spring-boot-starter-test&lt;\/artifactId&gt;\r\n\t\t\t&lt;scope&gt;test&lt;\/scope&gt;\r\n\t\t&lt;\/dependency&gt;\r\n\r\n\t\t&lt;dependency&gt;\r\n\t\t\t&lt;groupId&gt;org.springframework.boot&lt;\/groupId&gt;\r\n\t\t\t&lt;artifactId&gt;spring-boot-starter-thymeleaf&lt;\/artifactId&gt;\r\n\t\t&lt;\/dependency&gt;\r\n\r\n\t\t&lt;dependency&gt;\r\n\t\t\t&lt;groupId&gt;org.springframework.boot&lt;\/groupId&gt;\r\n\t\t\t&lt;artifactId&gt;spring-boot-starter-data-jpa&lt;\/artifactId&gt;\r\n\t\t&lt;\/dependency&gt;\r\n\r\n\t\t&lt;dependency&gt;\r\n\t\t\t&lt;groupId&gt;org.hsqldb&lt;\/groupId&gt;\r\n\t\t\t&lt;artifactId&gt;hsqldb&lt;\/artifactId&gt;\r\n\t\t&lt;\/dependency&gt;\r\n\t&lt;\/dependencies&gt;\r\n\r\n\t&lt;build&gt;\r\n\t\t&lt;plugins&gt;\r\n\t\t\t&lt;plugin&gt;\r\n\t\t\t\t&lt;groupId&gt;org.springframework.boot&lt;\/groupId&gt;\r\n\t\t\t\t&lt;artifactId&gt;spring-boot-maven-plugin&lt;\/artifactId&gt;\r\n\t\t\t&lt;\/plugin&gt;\r\n\t\t&lt;\/plugins&gt;\r\n\t&lt;\/build&gt;\r\n\r\n&lt;\/project&gt;\r\n<\/pre>\n<p>HSQLDB\u3092\u8d77\u52d5\u3059\u308bBAT\u30d5\u30a1\u30a4\u30eb\u306b\u3001\u65b0\u3057\u3044\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u8ffd\u52a0\u3059\u308b\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\ncd C:\\pleiades\\hsqldb-2.4.1\\hsqldb\\lib\r\njava -cp hsqldb.jar org.hsqldb.Server --database.0 db\/mydata --dbname.0 mydata --database.1 db\/stunes --dbname.1 stunes\r\n<\/pre>\n<p>Music\u30a8\u30f3\u30c6\u30a3\u30c6\u30a3\u3092\u4f5c\u6210\u3059\u308b\u3002<\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\r\npackage jp.abc;\r\n\r\nimport javax.persistence.Column;\r\nimport javax.persistence.Entity;\r\nimport javax.persistence.GeneratedValue;\r\nimport javax.persistence.GenerationType;\r\nimport javax.persistence.Id;\r\nimport javax.validation.constraints.NotEmpty;\r\nimport javax.validation.constraints.NotNull;\r\n\r\n@Entity\r\npublic class Music {\r\n\t@Id\r\n\t@GeneratedValue(strategy = GenerationType.AUTO)\r\n\t@Column\r\n\t@NotNull\r\n\tprivate long id;\r\n\r\n\t@Column(length = 200, nullable = false)\r\n\t@NotEmpty\r\n\tprivate String title;\r\n\r\n\t@Column(length = 200, nullable = false)\r\n\t@NotEmpty\r\n\tprivate String artist;\r\n\r\n\tpublic long getId() {\r\n\t\treturn id;\r\n\t}\r\n\r\n\tpublic void setId(long id) {\r\n\t\tthis.id = id;\r\n\t}\r\n\r\n\tpublic String getTitle() {\r\n\t\treturn title;\r\n\t}\r\n\r\n\tpublic void setTitle(String title) {\r\n\t\tthis.title = title;\r\n\t}\r\n\r\n\tpublic String getArtist() {\r\n\t\treturn artist;\r\n\t}\r\n\r\n\tpublic void setArtist(String artist) {\r\n\t\tthis.artist = artist;\r\n\t}\r\n\r\n\t@Override\r\n\tpublic String toString() {\r\n\t\treturn &quot;Music [title=&quot; + title + &quot;, artist=&quot; + artist + &quot;]&quot;;\r\n\t}\r\n\r\n}\r\n<\/pre>\n<p>\u30ea\u30dd\u30b8\u30c8\u30ea\u3092\u4f5c\u6210\u3059\u308b\u3002<\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\r\npackage jp.abc;\r\n\r\nimport org.springframework.data.jpa.repository.JpaRepository;\r\n\r\npublic interface MusicRepository extends JpaRepository&lt;Music, Long&gt; {\r\n\r\n}\r\n<\/pre>\n<p>\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u3092\u4f5c\u6210\u3059\u308b\u3002<\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\r\npackage jp.abc;\r\n\r\nimport org.springframework.beans.factory.annotation.Autowired;\r\nimport org.springframework.stereotype.Controller;\r\nimport org.springframework.web.bind.annotation.RequestMapping;\r\nimport org.springframework.web.servlet.ModelAndView;\r\n\r\n@Controller\r\npublic class MusicController {\r\n\r\n\t@Autowired\r\n\tprivate MusicRepository repository;\r\n\r\n\t@RequestMapping(&quot;\/&quot;)\r\n\tpublic ModelAndView index(ModelAndView mav) {\r\n\t\tmav.setViewName(&quot;index&quot;);\r\n\t\treturn mav;\r\n\t}\r\n}\r\n<\/pre>\n<p>HTML\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u3092\u4f5c\u6210\u3059\u308b\u3002<br \/>\nCSS\u3068\u5165\u529b\u30d5\u30a9\u30fc\u30e0\u306e\u90e8\u5206\u306f\u3001mydata.html \u306e\u8a72\u5f53\u7b87\u6240\u3092\u30b3\u30d4\u30fc\u3057\u3066\u4f7f\u3046\u3068\u65e9\u3044\u3002<\/p>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">\r\n&lt;!DOCTYPE html&gt;\r\n&lt;html xmlns:th=&quot;http:\/\/www.thymeleaf.org&quot;&gt;\r\n&lt;head&gt;\r\n&lt;meta charset=&quot;UTF-8&quot;&gt;\r\n&lt;title&gt;\u30df\u30e5\u30fc\u30b8\u30c3\u30af\u30d7\u30ec\u30a4\u30e4\u30fc&lt;\/title&gt;\r\n&lt;style type=&quot;text\/css&quot;&gt;\r\nh1 {\r\n  font-size: 18pt;\r\n  font-weight: bold;\r\n  color: gray;\r\n}\r\nbody {\r\n  font-size: 13pt;\r\n  color: gray;\r\n  margin: 5px 25px;\r\n}\r\npre {\r\n  border: solid 3px #ddd;\r\n  padding: 10px;\r\n}\r\ntr {\r\n  margin: 5px;\r\n}\r\nth {\r\n  padding: 5px;\r\n  color: white;\r\n  background: darkgray;\r\n}\r\ntd {\r\n  padding: 5px;\r\n  color: black;\r\n  background: #f0f0f0;\r\n}\r\n.err {\r\n  color: red;\r\n}\r\n&lt;\/style&gt;\r\n&lt;\/head&gt;\r\n&lt;body&gt;\r\n\r\n&lt;h1&gt;\u30df\u30e5\u30fc\u30b8\u30c3\u30af\u30d7\u30ec\u30a4\u30e4\u30fc&lt;\/h1&gt;\r\n&lt;p th:text=&quot;${msg}&quot;&gt;&lt;\/p&gt;\r\n&lt;form method=&quot;post&quot; action=&quot;\/&quot; th:object=&quot;${formModel}&quot;&gt;\r\n  &lt;table&gt;\r\n    &lt;tr&gt;\r\n      &lt;td&gt;&lt;label for=&quot;title&quot;&gt;\u30bf\u30a4\u30c8\u30eb&lt;\/label&gt;&lt;\/td&gt;\r\n      &lt;td&gt;\r\n        &lt;input type=&quot;text&quot; name=&quot;title&quot; th:value=&quot;*{title}&quot;\r\n      \t\t\tth:errorclass=&quot;err&quot; \/&gt;\r\n      \t&lt;div th:if=&quot;${#fields.hasErrors('title')}&quot; th:errors=&quot;*{title}&quot;\r\n      \t\tth:errorclass=&quot;err&quot;&gt;&lt;\/div&gt;\r\n      &lt;\/td&gt;\r\n    &lt;\/tr&gt;\r\n    &lt;tr&gt;\r\n      &lt;td&gt;&lt;label for=&quot;artist&quot;&gt;\u30a2\u30fc\u30c6\u30a3\u30b9\u30c8&lt;\/label&gt;&lt;\/td&gt;\r\n      &lt;td&gt;\r\n        &lt;input type=&quot;text&quot; name=&quot;artist&quot; th:value=&quot;*{artist}&quot;\r\n      \t\t\tth:errorclass=&quot;err&quot;\/&gt;\r\n      \t&lt;div th:if=&quot;${#fields.hasErrors('artist')}&quot; th:errors=&quot;*{artist}&quot;\r\n      \t\tth:errorclass=&quot;err&quot;&gt;&lt;\/div&gt;\r\n      &lt;\/td&gt;\r\n    &lt;\/tr&gt;\r\n    &lt;tr&gt;\r\n      &lt;td&gt;&lt;\/td&gt;\r\n      &lt;td&gt;&lt;input type=&quot;submit&quot; \/&gt;&lt;\/td&gt;\r\n    &lt;\/tr&gt;\r\n  &lt;\/table&gt;\r\n&lt;\/form&gt;\r\n\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;\r\n<\/pre>\n<p>\u3053\u308c\u3067\u5b9f\u884c\u3059\u308b\u3068\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3059\u308b\u3002<br \/>\n\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u3067 formModel \u3092\u6e21\u3057\u3066\u3044\u306a\u3044\u306e\u304c\u539f\u56e0\u306a\u306e\u3067\u3001\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u3092\u4fee\u6b63\u3059\u308b\u3002<\/p>\n<pre class=\"brush: java; highlight: [17,18]; title: ; notranslate\" title=\"\">\r\npackage jp.abc;\r\n\r\nimport org.springframework.beans.factory.annotation.Autowired;\r\nimport org.springframework.stereotype.Controller;\r\nimport org.springframework.web.bind.annotation.RequestMapping;\r\nimport org.springframework.web.servlet.ModelAndView;\r\n\r\n@Controller\r\npublic class MusicController {\r\n\r\n\t@Autowired\r\n\tprivate MusicRepository repository;\r\n\r\n\t@RequestMapping(&quot;\/&quot;)\r\n\tpublic ModelAndView index(ModelAndView mav) {\r\n\t\tmav.setViewName(&quot;index&quot;);\r\n\t\tMusic m = new Music();\r\n\t\tmav.addObject(&quot;formModel&quot;, m);\r\n\t\treturn mav;\r\n\t}\r\n}\r\n<\/pre>\n<p>POST\u30e1\u30bd\u30c3\u30c9\u3092\u53d7\u3051\u4ed8\u3051\u308b\u3088\u3046\u306b\u3059\u308b\u305f\u3081\u306b\u3001\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u3092\u4fee\u6b63\u3059\u308b\u3002<\/p>\n<pre class=\"brush: java; highlight: [18,26,27,28,29,30,31,32,33,34,35,36,37,38]; title: ; notranslate\" title=\"\">\r\npackage jp.abc;\r\n\r\nimport org.springframework.beans.factory.annotation.Autowired;\r\nimport org.springframework.stereotype.Controller;\r\nimport org.springframework.validation.Errors;\r\nimport org.springframework.validation.annotation.Validated;\r\nimport org.springframework.web.bind.annotation.ModelAttribute;\r\nimport org.springframework.web.bind.annotation.RequestMapping;\r\nimport org.springframework.web.bind.annotation.RequestMethod;\r\nimport org.springframework.web.servlet.ModelAndView;\r\n\r\n@Controller\r\npublic class MusicController {\r\n\r\n\t@Autowired\r\n\tprivate MusicRepository repository;\r\n\r\n\t@RequestMapping(value = &quot;\/&quot;, method = RequestMethod.GET)\r\n\tpublic ModelAndView index(ModelAndView mav) {\r\n\t\tmav.setViewName(&quot;index&quot;);\r\n\t\tMusic m = new Music();\r\n\t\tmav.addObject(&quot;formModel&quot;, m);\r\n\t\treturn mav;\r\n\t}\r\n\r\n\t@RequestMapping(value = &quot;\/&quot;, method = RequestMethod.POST)\r\n\tpublic ModelAndView post(\r\n\t\t\t@ModelAttribute(&quot;formModel&quot;) @Validated Music music,\r\n\t\t\tErrors result,\r\n\t\t\tModelAndView mav) {\r\n\t\tif (result.hasErrors()) {\r\n\t\t\tmav.setViewName(&quot;index&quot;);\r\n\t\t\tmav.addObject(&quot;msg&quot;, &quot;\u30a8\u30e9\u30fc\u3067\u3059&quot;);\r\n\t\t\treturn mav;\r\n\t\t}\r\n\t\trepository.saveAndFlush(music);\r\n\t\treturn new ModelAndView(&quot;redirect:\/&quot;);\r\n\t}\r\n}\r\n<\/pre>\n<p>\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u63a5\u7d9a\u306e\u8a2d\u5b9a\u3092\u3001application.properties \u30d5\u30a1\u30a4\u30eb\u306b\u8a18\u8ff0\u3059\u308b\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nspring.datasource.url=jdbc:hsqldb:hsql:\/\/localhost\/stunes\r\nspring.datasource.username=sa\r\nspring.datasource.password=\r\nspring.datasource.driver-class-name=org.hsqldb.jdbc.JDBCDriver\r\nspring.jpa.properties.hibernate.dialect=org.hibernate.dialect.HSQLDialect\r\nspring.jpa.hibernate.ddl-auto=update\r\n<\/pre>\n<p>HTML\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u306b\u3001\u4fdd\u5b58\u3055\u308c\u3066\u3044\u308b\u30c7\u30fc\u30bf\u306e\u30ea\u30b9\u30c8\u3092\u8868\u793a\u3059\u308b\u30c6\u30fc\u30d6\u30eb\u3092\u8ffd\u52a0\u3059\u308b\u3002<\/p>\n<pre class=\"brush: xml; highlight: [70,71,72,73,74,75,76,77,78,79,80,81,82]; title: ; notranslate\" title=\"\">\r\n&lt;!DOCTYPE html&gt;\r\n&lt;html xmlns:th=&quot;http:\/\/www.thymeleaf.org&quot;&gt;\r\n&lt;head&gt;\r\n&lt;meta charset=&quot;UTF-8&quot;&gt;\r\n&lt;title&gt;\u30df\u30e5\u30fc\u30b8\u30c3\u30af\u30d7\u30ec\u30a4\u30e4\u30fc&lt;\/title&gt;\r\n&lt;style type=&quot;text\/css&quot;&gt;\r\nh1 {\r\n  font-size: 18pt;\r\n  font-weight: bold;\r\n  color: gray;\r\n}\r\nbody {\r\n  font-size: 13pt;\r\n  color: gray;\r\n  margin: 5px 25px;\r\n}\r\npre {\r\n  border: solid 3px #ddd;\r\n  padding: 10px;\r\n}\r\ntr {\r\n  margin: 5px;\r\n}\r\nth {\r\n  padding: 5px;\r\n  color: white;\r\n  background: darkgray;\r\n}\r\ntd {\r\n  padding: 5px;\r\n  color: black;\r\n  background: #f0f0f0;\r\n}\r\n.err {\r\n  color: red;\r\n}\r\n&lt;\/style&gt;\r\n&lt;\/head&gt;\r\n&lt;body&gt;\r\n\r\n&lt;h1&gt;\u30df\u30e5\u30fc\u30b8\u30c3\u30af\u30d7\u30ec\u30a4\u30e4\u30fc&lt;\/h1&gt;\r\n&lt;p th:text=&quot;${msg}&quot;&gt;&lt;\/p&gt;\r\n&lt;form method=&quot;post&quot; action=&quot;\/&quot; th:object=&quot;${formModel}&quot;&gt;\r\n  &lt;table&gt;\r\n    &lt;tr&gt;\r\n      &lt;td&gt;&lt;label for=&quot;title&quot;&gt;\u30bf\u30a4\u30c8\u30eb&lt;\/label&gt;&lt;\/td&gt;\r\n      &lt;td&gt;\r\n        &lt;input type=&quot;text&quot; name=&quot;title&quot; th:value=&quot;*{title}&quot;\r\n      \t\t\tth:errorclass=&quot;err&quot; \/&gt;\r\n      \t&lt;div th:if=&quot;${#fields.hasErrors('title')}&quot; th:errors=&quot;*{title}&quot;\r\n      \t\tth:errorclass=&quot;err&quot;&gt;&lt;\/div&gt;\r\n      &lt;\/td&gt;\r\n    &lt;\/tr&gt;\r\n    &lt;tr&gt;\r\n      &lt;td&gt;&lt;label for=&quot;artist&quot;&gt;\u30a2\u30fc\u30c6\u30a3\u30b9\u30c8&lt;\/label&gt;&lt;\/td&gt;\r\n      &lt;td&gt;\r\n        &lt;input type=&quot;text&quot; name=&quot;artist&quot; th:value=&quot;*{artist}&quot;\r\n      \t\t\tth:errorclass=&quot;err&quot;\/&gt;\r\n      \t&lt;div th:if=&quot;${#fields.hasErrors('artist')}&quot; th:errors=&quot;*{artist}&quot;\r\n      \t\tth:errorclass=&quot;err&quot;&gt;&lt;\/div&gt;\r\n      &lt;\/td&gt;\r\n    &lt;\/tr&gt;\r\n    &lt;tr&gt;\r\n      &lt;td&gt;&lt;\/td&gt;\r\n      &lt;td&gt;&lt;input type=&quot;submit&quot; \/&gt;&lt;\/td&gt;\r\n    &lt;\/tr&gt;\r\n  &lt;\/table&gt;\r\n&lt;\/form&gt;\r\n\r\n&lt;hr \/&gt;\r\n&lt;table&gt;\r\n  &lt;tr&gt;\r\n    &lt;th&gt;ID&lt;\/th&gt;&lt;th&gt;\u30bf\u30a4\u30c8\u30eb&lt;\/th&gt;&lt;th&gt;\u30a2\u30fc\u30c6\u30a3\u30b9\u30c8&lt;\/th&gt;&lt;th&gt;\u7de8\u96c6&lt;\/th&gt;&lt;th&gt;\u524a\u9664&lt;\/th&gt;\r\n  &lt;\/tr&gt;\r\n  &lt;tr th:each=&quot;obj : ${datalist}&quot;&gt;\r\n    &lt;td th:text=&quot;${obj.id}&quot;&gt;&lt;\/td&gt;\r\n    &lt;td th:text=&quot;${obj.title}&quot;&gt;&lt;\/td&gt;\r\n    &lt;td th:text=&quot;${obj.artist}&quot;&gt;&lt;\/td&gt;\r\n    &lt;td&gt;&lt;a th:href=&quot;@{'\/edit\/' + ${obj.id}}&quot;&gt;\u7de8\u96c6&lt;\/a&gt;&lt;\/td&gt;\r\n    &lt;td&gt;&lt;a th:href=&quot;@{'\/delete\/' + ${obj.id}}&quot;&gt;\u524a\u9664&lt;\/a&gt;&lt;\/td&gt;\r\n  &lt;\/tr&gt;\r\n&lt;\/table&gt;\r\n\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;\r\n<\/pre>\n<p>\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u3067\u3001datalist \u306e\u540d\u524d\u3067\u3001\u30c7\u30fc\u30bf\u3092\u308f\u305f\u3059\u3002<\/p>\n<pre class=\"brush: java; first-line: 20; highlight: [25,26]; title: ; notranslate\" title=\"\">\r\n\t@RequestMapping(value = &quot;\/&quot;, method = RequestMethod.GET)\r\n\tpublic ModelAndView index(ModelAndView mav) {\r\n\t\tmav.setViewName(&quot;index&quot;);\r\n\t\tMusic m = new Music();\r\n\t\tmav.addObject(&quot;formModel&quot;, m);\r\n\t\tList&lt;Music&gt; list = repository.findAll();\r\n\t\tmav.addObject(&quot;datalist&quot;, list);\r\n\t\treturn mav;\r\n\t}\r\n<\/pre>\n<h3>\u30d7\u30ec\u30a4\u30ea\u30b9\u30c8\u3082\u4f5c\u3063\u3066\u307f\u308b<\/h3>\n<p>\u307e\u305a\u306f\u30a8\u30f3\u30c6\u30a3\u30c6\u30a3\u3092\u4f5c\u6210\u3059\u308b\u3002<\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\r\npackage jp.abc;\r\n\r\nimport javax.persistence.Column;\r\nimport javax.persistence.Entity;\r\nimport javax.persistence.GeneratedValue;\r\nimport javax.persistence.GenerationType;\r\nimport javax.persistence.Id;\r\nimport javax.validation.constraints.NotEmpty;\r\nimport javax.validation.constraints.NotNull;\r\n\r\n@Entity\r\npublic class PlayList {\r\n\t@Id\r\n\t@GeneratedValue(strategy = GenerationType.AUTO)\r\n\t@Column\r\n\t@NotNull\r\n\tprivate long id;\r\n\r\n\t@Column(length = 200, nullable = false)\r\n\t@NotEmpty\r\n\tprivate String name;\r\n\r\n\tpublic long getId() {\r\n\t\treturn id;\r\n\t}\r\n\r\n\tpublic void setId(long id) {\r\n\t\tthis.id = id;\r\n\t}\r\n\r\n\tpublic String getName() {\r\n\t\treturn name;\r\n\t}\r\n\r\n\tpublic void setName(String name) {\r\n\t\tthis.name = name;\r\n\t}\r\n\r\n\r\n}\r\n<\/pre>\n<p>HTML\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u3092\u4f5c\u6210\u3059\u308b\u3002<\/p>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">\r\n&lt;!DOCTYPE html&gt;\r\n&lt;html xmlns:th=&quot;http:\/\/www.thymeleaf.org&quot;&gt;\r\n&lt;head&gt;\r\n&lt;meta charset=&quot;UTF-8&quot;&gt;\r\n&lt;title&gt;\u30d7\u30ec\u30a4\u30ea\u30b9\u30c8&lt;\/title&gt;\r\n&lt;style type=&quot;text\/css&quot;&gt;\r\nh1 {\r\n  font-size: 18pt;\r\n  font-weight: bold;\r\n  color: gray;\r\n}\r\nbody {\r\n  font-size: 13pt;\r\n  color: gray;\r\n  margin: 5px 25px;\r\n}\r\npre {\r\n  border: solid 3px #ddd;\r\n  padding: 10px;\r\n}\r\ntr {\r\n  margin: 5px;\r\n}\r\nth {\r\n  padding: 5px;\r\n  color: white;\r\n  background: darkgray;\r\n}\r\ntd {\r\n  padding: 5px;\r\n  color: black;\r\n  background: #f0f0f0;\r\n}\r\n.err {\r\n  color: red;\r\n}\r\n&lt;\/style&gt;\r\n&lt;\/head&gt;\r\n&lt;body&gt;\r\n\r\n&lt;h1&gt;\u30d7\u30ec\u30a4\u30ea\u30b9\u30c8&lt;\/h1&gt;\r\n&lt;p th:text=&quot;${msg}&quot;&gt;&lt;\/p&gt;\r\n&lt;form method=&quot;post&quot; action=&quot;\/&quot; th:object=&quot;${formModel}&quot;&gt;\r\n  &lt;table&gt;\r\n    &lt;tr&gt;\r\n      &lt;td&gt;&lt;label for=&quot;name&quot;&gt;\u540d\u524d&lt;\/label&gt;&lt;\/td&gt;\r\n      &lt;td&gt;\r\n        &lt;input type=&quot;text&quot; name=&quot;name&quot; th:value=&quot;*{name}&quot;\r\n      \t\t\tth:errorclass=&quot;err&quot; \/&gt;\r\n      \t&lt;div th:if=&quot;${#fields.hasErrors('name')}&quot; th:errors=&quot;*{name}&quot;\r\n      \t\tth:errorclass=&quot;err&quot;&gt;&lt;\/div&gt;\r\n      &lt;\/td&gt;\r\n    &lt;\/tr&gt;\r\n    &lt;tr&gt;\r\n      &lt;td&gt;&lt;\/td&gt;\r\n      &lt;td&gt;&lt;input type=&quot;submit&quot; \/&gt;&lt;\/td&gt;\r\n    &lt;\/tr&gt;\r\n  &lt;\/table&gt;\r\n&lt;\/form&gt;\r\n\r\n&lt;hr \/&gt;\r\n&lt;table&gt;\r\n  &lt;tr&gt;\r\n    &lt;th&gt;ID&lt;\/th&gt;&lt;th&gt;\u540d\u524d&lt;\/th&gt;\r\n  &lt;\/tr&gt;\r\n  &lt;tr th:each=&quot;obj : ${datalist}&quot;&gt;\r\n    &lt;td th:text=&quot;${obj.id}&quot;&gt;&lt;\/td&gt;\r\n    &lt;td th:text=&quot;${obj.title}&quot;&gt;&lt;\/td&gt;\r\n  &lt;\/tr&gt;\r\n&lt;\/table&gt;\r\n\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;\r\n<\/pre>\n<p>\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u3092\u4f5c\u6210\u3059\u308b\u3002<\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\r\npackage jp.abc;\r\n\r\nimport org.springframework.stereotype.Controller;\r\nimport org.springframework.web.bind.annotation.RequestMapping;\r\nimport org.springframework.web.servlet.ModelAndView;\r\n\r\n@Controller\r\npublic class PlayListController {\r\n\t@RequestMapping(&quot;\/playlist&quot;)\r\n\tpublic ModelAndView list(ModelAndView mav) {\r\n\t\tmav.setViewName(&quot;playlist&quot;);\r\n\t\tPlayList pl = new PlayList();\r\n\t\tmav.addObject(&quot;formModel&quot;, pl);\r\n\t\treturn mav;\r\n\t}\r\n}\r\n<\/pre>\n<p>\u52d5\u3044\u305f\uff01<\/p>\n<p><img loading=\"lazy\" src=\"http:\/\/2019se3.satoshis.jp\/wp-content\/uploads\/2019\/07\/playlist-300x251.png\" alt=\"\" width=\"300\" height=\"251\" class=\"alignnone size-medium wp-image-222\" srcset=\"https:\/\/2019se3.satoshis.jp\/wp-content\/uploads\/2019\/07\/playlist-300x251.png 300w, https:\/\/2019se3.satoshis.jp\/wp-content\/uploads\/2019\/07\/playlist.png 629w\" sizes=\"(max-width: 300px) 85vw, 300px\" \/><\/p>\n\n<div style=\"font-size: 0px; height: 0px; line-height: 0px; margin: 0; padding: 0; clear: both;\"><\/div>","protected":false},"excerpt":{"rendered":"<p>\u30df\u30e5\u30fc\u30b8\u30c3\u30af\u30d7\u30ec\u30a4\u30e4\u30fc\u306eWeb\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u4f5c\u3063\u3066\u307f\u308b \u4ee5\u524d\u3001Java\u30b3\u30f3\u30bd\u30fc\u30eb\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3068\u3057\u3066MusicPlayer\u3092\u4f5c\u6210\u3057\u305f\u304c\u3001\u4eca\u56de\u306f\u3001\u305d\u308c\u3092SpringBoot\u3092\u4f7f\u7528\u3057\u305fWeb\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3068\u3057\u3066\u4f5c\u6210\u3057 &hellip; <a href=\"https:\/\/2019se3.satoshis.jp\/?p=209\" class=\"more-link\"><span class=\"screen-reader-text\">&#8220;7\u67082\u65e5&#8221; \u306e<\/span>\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[3],"tags":[],"_links":{"self":[{"href":"https:\/\/2019se3.satoshis.jp\/index.php?rest_route=\/wp\/v2\/posts\/209"}],"collection":[{"href":"https:\/\/2019se3.satoshis.jp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/2019se3.satoshis.jp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/2019se3.satoshis.jp\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/2019se3.satoshis.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=209"}],"version-history":[{"count":13,"href":"https:\/\/2019se3.satoshis.jp\/index.php?rest_route=\/wp\/v2\/posts\/209\/revisions"}],"predecessor-version":[{"id":223,"href":"https:\/\/2019se3.satoshis.jp\/index.php?rest_route=\/wp\/v2\/posts\/209\/revisions\/223"}],"wp:attachment":[{"href":"https:\/\/2019se3.satoshis.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=209"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/2019se3.satoshis.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=209"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/2019se3.satoshis.jp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=209"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}