{"id":132,"date":"2020-12-03T13:37:16","date_gmt":"2020-12-03T04:37:16","guid":{"rendered":"http:\/\/kpc2020.satoshis.jp\/?p=132"},"modified":"2020-12-03T13:53:24","modified_gmt":"2020-12-03T04:53:24","slug":"javascript%e3%81%a7%e5%8b%95%e3%81%8d%e3%82%92%e3%81%a4%e3%81%91%e3%81%a6%e3%81%bf%e3%82%8b","status":"publish","type":"post","link":"https:\/\/kpc2020.satoshis.jp\/?p=132","title":{"rendered":"JavaScript\u3067\u52d5\u304d\u3092\u3064\u3051\u3066\u307f\u308b"},"content":{"rendered":"<p>\u672c\u306e\u7de8\u96c6\u753b\u9762\u3067\u753b\u50cfURL\u3092\u5165\u529b\u3057\u305f\u3068\u304d\u306b\u3001\u753b\u50cf\u306e\u30d7\u30ec\u30d3\u30e5\u30fc\u3092\u8868\u793a\u3059\u308b\u3002<\/p>\n<p>src\/main\/resources \u306b\u3042\u308b static \u30d5\u30a9\u30eb\u30c0\u306b js \u30d5\u30a9\u30eb\u30c0\u3092\u65b0\u898f\u4f5c\u6210\u3059\u308b\u3002<br \/>\n\u305d\u306e\u30d5\u30a9\u30eb\u30c0\u306b\u3001jQuery\u30d5\u30a1\u30a4\u30eb\u3092\u8cbc\u308a\u4ed8\u3051\u308b\u3002<\/p>\n<p>\u307e\u305a\u3001\u958b\u767a\u8005\u30c4\u30fc\u30eb\u306eJavaScript\u30b3\u30f3\u30bd\u30fc\u30eb\u3067\u3084\u308a\u305f\u3044\u52d5\u304d\u3092\u78ba\u8a8d\u3059\u308b\u3002<br \/>\n\u3046\u307e\u304f\u52d5\u3044\u305f\u3089\u3001\u305d\u306e\u5185\u5bb9\u3092 script \u30bf\u30b0\u5185\u306b\u8a18\u8ff0\u3059\u308b\u3002<\/p>\n<p>img\u30bf\u30b0\u306b\u8868\u7d19\u3068\u3044\u3046\u610f\u5473\u3067id=cover\u3092\u5272\u308a\u5f53\u3066\u3066\u304a\u304f\u3002<\/p>\n<p>editbook.html<\/p>\n<pre class=\"brush: xml; highlight: [6,7,8,9,10,11,12,13,21]; 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;Book - \u672c\u306e\u7de8\u96c6&lt;\/title&gt;\r\n&lt;script src=&quot;\/js\/jquery-1.12.4.min.js&quot;&gt;&lt;\/script&gt;\r\n&lt;script type=&quot;text\/javascript&quot;&gt;\r\n$(function() {\r\n\t$('&#x5B;name=image]').on('keyup', function() {\r\n\t\t$('#cover').prop('src', $(this).val());\r\n\t})\r\n});\r\n&lt;\/script&gt;\r\n&lt;\/head&gt;\r\n&lt;body&gt;\r\n\r\n&lt;a href=&quot;\/&quot;&gt;\u30c8\u30c3\u30d7&lt;\/a&gt;\r\n\r\n&lt;h1&gt;\u672c\u306e\u7de8\u96c6&lt;\/h1&gt;\r\n\r\n&lt;img id=&quot;cover&quot; th:src=&quot;${book.image}&quot; width=&quot;200&quot; \/&gt;\r\n\r\n&lt;form action=&quot;\/book\/edit&quot; method=&quot;post&quot;&gt;\r\n\t&lt;input type=&quot;hidden&quot; name=&quot;id&quot; th:value=&quot;${book.id}&quot; \/&gt;\r\n\t&lt;div&gt;\u30bf\u30a4\u30c8\u30eb: &lt;input type=&quot;text&quot; name=&quot;title&quot; th:value=&quot;${book.title}&quot; \/&gt;&lt;\/div&gt;\r\n\t&lt;div&gt;\u8457\u8005: &lt;input type=&quot;text&quot; name=&quot;author&quot; th:value=&quot;${book.author}&quot; \/&gt;&lt;\/div&gt;\r\n\t&lt;div&gt;\u753b\u50cfURL: &lt;input type=&quot;text&quot; name=&quot;image&quot; th:value=&quot;${book.image}&quot; \/&gt;&lt;\/div&gt;\r\n\t&lt;div&gt;&lt;input id=&quot;submit&quot; type=&quot;submit&quot; value=&quot;\u4fee\u6b63&quot; \/&gt;&lt;\/div&gt;\r\n&lt;\/form&gt;\r\n\r\n\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;\r\n<\/pre>\n<p>\u672c\u306e\u30ea\u30b9\u30c8\u306e\u753b\u9762\u3082\u540c\u3058\u3088\u3046\u306a\u52d5\u304d\u306b\u306a\u308b\u3088\u3046\u306b\u4fee\u6b63\u3057\u3066\u307f\u308b\u3002<\/p>\n<p>books.html<\/p>\n<pre class=\"brush: xml; highlight: [6,7,8,9,10,11,12,13,38,42]; 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;Book - \u672c\u306e\u30ea\u30b9\u30c8&lt;\/title&gt;\r\n&lt;script src=&quot;\/js\/jquery-1.12.4.min.js&quot;&gt;&lt;\/script&gt;\r\n&lt;script type=&quot;text\/javascript&quot;&gt;\r\n$(function() {\r\n\t$('&#x5B;name=image]').on('keyup', function() {\r\n\t\t$('#cover').prop('src', $(this).val());\r\n\t})\r\n});\r\n&lt;\/script&gt;\r\n&lt;\/head&gt;\r\n&lt;body&gt;\r\n\r\n&lt;h1&gt;Book list&lt;\/h1&gt;\r\n\r\n&lt;a href=&quot;\/&quot;&gt;\u30c8\u30c3\u30d7&lt;\/a&gt;\r\n\r\n&lt;table&gt;\r\n\t&lt;tr&gt;\r\n\t\t&lt;th&gt;ID&lt;\/th&gt;&lt;th&gt;\u753b\u50cf&lt;\/th&gt;&lt;th&gt;\u30bf\u30a4\u30c8\u30eb&lt;\/th&gt;&lt;th&gt;\u8457\u8005&lt;\/th&gt;&lt;th&gt;\u672c\u68da&lt;\/th&gt;\r\n\t&lt;\/tr&gt;\r\n\t&lt;tr th:each=&quot;book : ${list}&quot;&gt;\r\n\t\t&lt;td th:text=&quot;${book.id}&quot;&gt;&lt;\/td&gt;\r\n\t\t&lt;td&gt;&lt;img th:src=&quot;${book.image}&quot; height=&quot;50&quot; \/&gt;&lt;\/td&gt;\r\n\t\t&lt;td&gt;&lt;a th:href=&quot;@{'\/book\/' + ${book.id}}&quot; th:text=&quot;${book.title}&quot;&gt;&lt;\/a&gt;&lt;\/td&gt;\r\n\t\t&lt;td th:text=&quot;${book.author}&quot;&gt;&lt;\/td&gt;\r\n\t\t&lt;td th:if=&quot;${book.bookshelf != null}&quot; th:text=&quot;${book.bookshelf.name}&quot;&gt;&lt;\/td&gt;\r\n\t\t&lt;td th:if=&quot;${book.bookshelf == null}&quot; th:text=&quot;\u672c\u68da\u306b\u5165\u308c\u3066\u307e\u305b\u3093&quot;&gt;&lt;\/td&gt;\r\n\t&lt;\/tr&gt;\r\n&lt;\/table&gt;\r\n\r\n&lt;hr \/&gt;\r\n\r\n&lt;div&gt;\u65b0\u3057\u3044\u672c&lt;\/div&gt;\r\n&lt;img id=&quot;cover&quot; src=&quot;&quot; width=&quot;200&quot; \/&gt;\r\n&lt;form action=&quot;\/addbook&quot; method=&quot;post&quot;&gt;\r\n\t&lt;div&gt;\u30bf\u30a4\u30c8\u30eb: &lt;input type=&quot;text&quot; name=&quot;title&quot; \/&gt;&lt;\/div&gt;\r\n\t&lt;div&gt;\u8457\u8005: &lt;input type=&quot;text&quot; name=&quot;author&quot; \/&gt;&lt;\/div&gt;\r\n\t&lt;div&gt;\u753b\u50cfURL: &lt;input type=&quot;text&quot; name=&quot;image&quot; \/&gt;&lt;\/div&gt;\r\n\t&lt;div&gt;&lt;input id=&quot;submit&quot; type=&quot;submit&quot; value=&quot;+\u8ffd\u52a0&quot; \/&gt;&lt;\/div&gt;\r\n&lt;\/form&gt;\r\n\r\n\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;\r\n<\/pre>\n<p>\u4eca\u306e\u307e\u307e\u3067\u306f\u3001\u753b\u50cfURL\u3092\u5165\u529b\u3057\u3066\u3082\u4fdd\u5b58\u3057\u3066\u3044\u306a\u3044\u306e\u3067\u3001\u30b5\u30fc\u30d0\u30fc\u5074\u306b\u753b\u50cfURL\u3092\u4fdd\u5b58\u3059\u308b\u51e6\u7406\u3092\u8ffd\u52a0\u3059\u308b\u3002<\/p>\n<pre class=\"brush: java; first-line: 29; highlight: [33,37]; title: ; notranslate\" title=\"\">\r\n\t@RequestMapping(value=&quot;\/addbook&quot;, method=RequestMethod.POST)\r\n\tpublic ModelAndView formPost(ModelAndView mav,\r\n\t\t\t@RequestParam(&quot;title&quot;) String title,\r\n\t\t\t@RequestParam(&quot;author&quot;) String author,\r\n\t\t\t@RequestParam(&quot;image&quot;) String image) {\r\n\t\tBook book = new Book();\r\n\t\tbook.setTitle(title);\r\n\t\tbook.setAuthor(author);\r\n\t\tbook.setImage(image);\r\n\t\trepository.saveAndFlush(book);\r\n\t\treturn new ModelAndView(&quot;redirect:\/books&quot;);\r\n\t}\r\n<\/pre>\n<!--CusAds0-->\n<div style=\"font-size: 0px; height: 0px; line-height: 0px; margin: 0; padding: 0; clear: both;\"><\/div>","protected":false},"excerpt":{"rendered":"<p>\u672c\u306e\u7de8\u96c6\u753b\u9762\u3067\u753b\u50cfURL\u3092\u5165\u529b\u3057\u305f\u3068\u304d\u306b\u3001\u753b\u50cf\u306e\u30d7\u30ec\u30d3\u30e5\u30fc\u3092\u8868\u793a\u3059\u308b\u3002 src\/main\/resources \u306b\u3042\u308b static \u30d5\u30a9\u30eb\u30c0\u306b js \u30d5\u30a9\u30eb\u30c0\u3092\u65b0\u898f\u4f5c\u6210\u3059\u308b\u3002 \u305d\u306e\u30d5\u30a9\u30eb\u30c0\u306b\u3001jQuery\u30d5\u30a1\u30a4\u30eb\u3092\u8cbc\u308a\u4ed8 &hellip; <a href=\"https:\/\/kpc2020.satoshis.jp\/?p=132\" class=\"more-link\">\u7d9a\u304d\u3092\u8aad\u3080 <span class=\"screen-reader-text\">JavaScript\u3067\u52d5\u304d\u3092\u3064\u3051\u3066\u307f\u308b<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2,5],"tags":[],"class_list":["post-132","post","type-post","status-publish","format-standard","hentry","category-java","category-springboot"],"views":192,"_links":{"self":[{"href":"https:\/\/kpc2020.satoshis.jp\/index.php?rest_route=\/wp\/v2\/posts\/132","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kpc2020.satoshis.jp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kpc2020.satoshis.jp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kpc2020.satoshis.jp\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kpc2020.satoshis.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=132"}],"version-history":[{"count":5,"href":"https:\/\/kpc2020.satoshis.jp\/index.php?rest_route=\/wp\/v2\/posts\/132\/revisions"}],"predecessor-version":[{"id":137,"href":"https:\/\/kpc2020.satoshis.jp\/index.php?rest_route=\/wp\/v2\/posts\/132\/revisions\/137"}],"wp:attachment":[{"href":"https:\/\/kpc2020.satoshis.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=132"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kpc2020.satoshis.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=132"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kpc2020.satoshis.jp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=132"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}