{"id":93656,"date":"2019-06-28T10:00:15","date_gmt":"2019-06-28T07:00:15","guid":{"rendered":"https:\/\/www.javacodegeeks.com\/?p=93656"},"modified":"2019-06-27T11:48:53","modified_gmt":"2019-06-27T08:48:53","slug":"spring-with-rails-jquery-ujs","status":"publish","type":"post","link":"https:\/\/www.javacodegeeks.com\/2019\/06\/spring-with-rails-jquery-ujs.html","title":{"rendered":"Spring with Rails&#8217; jQuery UJS"},"content":{"rendered":"<p>I\u2019ve always wanted to try to see if I could use <a href=\"https:\/\/github.com\/rails\/jquery-ujs\">Rails\u2019 jQuery UJS<\/a> in a Spring Boot project. The UJS in jquery-ujs stands for <a href=\"http:\/\/en.wikipedia.org\/wiki\/Unobtrusive_JavaScript\">unobtrusive JavaScript<\/a>. I really like how UJS wires event handlers to eligible DOM elements marked with HTML5 <code>data-*<\/code> attributes. I find myself wanting to see more of this approach being used in Spring Boot web apps. I wonder why there\u2019s very little mentioned on the web about this. Or, may be I\u2019ve been looking at the wrong places.<\/p>\n<p>Anyway, here are some things jQuery UJS can do, and the related source code is on <a href=\"https:\/\/github.com\/lorenzodee\/spring-ujs-sjr\">GitHub<\/a> (albeit using a different example).<\/p>\n<h3 class=\"wp-block-heading\">Non-GET Links (e.g. DELETE)<\/h3>\n<p>When I need to render a link that deletes an item, I would use a <code>&lt;button&gt;<\/code> wrapped in a <code>&lt;form&gt;<\/code> with a hidden <code>_method<\/code> field with a value of <code>delete<\/code>. The <code>&lt;form&gt;<\/code> is not visible to the user. But the visible button is used to submit the <code>&lt;form&gt;<\/code>. Some CSS is used to make the button look like a link.<\/p>\n<pre class=\"wp-block-preformatted brush:html\">&lt;form action=\"\/articles\/42\" method=\"post\"&gt;\n  &lt;input type=\"hidden\" name=\"_method\" value=\"delete\" \/&gt;\n  &lt;button class=\"btn btn-link\"&gt;Delete&lt;\/button&gt;\n&lt;\/form&gt;<\/pre>\n<p>Thanks to Spring\u2019s <code>HiddenHttpMethodFilter<\/code> (also automatically configured in Spring Boot), when this <code>&lt;form&gt;<\/code> is submitted, it will be received as a request with a method of <code>DELETE<\/code>. It maps to <code>@DeleteMapping(path=\"\/articles\/{id}\")<\/code> in the related <code>@Controller<\/code>.<\/p>\n<p>While the above works, there is an easier way with jQuery UJS. All that is needed to render a link to delete an item is this:<\/p>\n<pre class=\"wp-block-preformatted brush:html\">&lt;a href=\"\/articles\/42\" data-method=\"delete\"&gt;Delete&lt;\/a&gt;<\/pre>\n<p>jQuery UJS will enhance links that have <code>data-method<\/code> attribute. When the above example link is clicked, the JavaScript will create a <code>&lt;form&gt;<\/code>. The action attribute of this <code>&lt;form&gt;<\/code> is set to the value of link\u2019s <code>href<\/code>. The method is set to <code>post<\/code>. A hidden <code>_method<\/code> field is added to the <code>&lt;form&gt;<\/code> and set to the value of the link\u2019s <code>data-method<\/code>. Finally, the <code>&lt;form&gt;<\/code> is submitted (and the link is not followed).<\/p>\n<h3 class=\"wp-block-heading\">Confirmation Dialogs<\/h3>\n<p>Most often than not, when it comes to deleting anything, it would be good to confirm with the user. This could be implemented as a simple dialog via <code>window.confirm()<\/code>. If we build from the previous example, the <code>&lt;form&gt;<\/code> would look like this:<\/p>\n<pre class=\"wp-block-preformatted brush:html\">&lt;form action=\"\/articles\/42\" method=\"post\"\n    onsubmit=\"return confirm('Are you sure?')\"&gt;\n  &lt;input type=\"hidden\" name=\"_method\" value=\"delete\" \/&gt;\n  &lt;button&gt;Delete&lt;\/button&gt;\n&lt;\/form&gt;<\/pre>\n<p>While the above works, jQuery UJS shows us a better way. All that is needed to confirm before deleting is this:<div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<pre class=\"wp-block-preformatted brush:html\">&lt;a href=\"\/articles\/42?delete\" data-method=\"delete\"\n    data-confirm=\"Are you sure?\"&gt;Delete&lt;\/a&gt;<\/pre>\n<p>jQuery UJS will enhance links (and <code>&lt;form&gt;<\/code>s too) that have <code>data-confirm<\/code> attribute. When the above example link is clicked, the JavaScript will call <code>confirm()<\/code> to show a dialog containing the text that is the value of the attribute. If the user chooses to cancel, the creation\/submission of the <code>&lt;form&gt;<\/code> (due to <code>data-method<\/code>) does not take place.<\/p>\n<h3 class=\"wp-block-heading\">Ajax Links<\/h3>\n<p>After deleting an item, the page usually reloads to show that the deleted element has indeed been removed.<\/p>\n<p>Let&#8217;s say the items are displayed in a table. Each row has a unique <code>id<\/code>.<\/p>\n<pre class=\"wp-block-preformatted brush:html\">&lt;table&gt;\n  &lt;tr id=\"article:18\"&gt;\n    &lt;!-- data cells for \/articles\/18 --&gt;\n    &lt;td&gt;&lt;a href=\"\/articles\/18?delete\"\n        data-method=\"delete\" data-confirm=\"Are you sure?\"&gt;Delete&lt;\/a&gt;&lt;\/td&gt;\n  &lt;\/tr&gt;\n  &lt;tr id=\"article:42\"&gt;\n    &lt;!-- data cells for \/articles\/42 --&gt;\n    &lt;td&gt;&lt;a href=\"\/articles\/42?delete\"\n        data-method=\"delete\" data-confirm=\"Are you sure?\"&gt;Delete&lt;\/a&gt;&lt;\/td&gt;\n  &lt;\/tr&gt;\n  &lt;!-- other rows --&gt;\n&lt;\/table&gt;<\/pre>\n<p>Assuming that we can simply remove the HTML element that represented the deleted item, then we can probably send the <code>DELETE<\/code> request asynchronously and get a response that would remove the related HTML element. jQuery UJS makes this as easy as adding <code>data-remote=\"true\"<\/code> and some minor changes to the server-side controller.<\/p>\n<p>For the HTML, all we need is <code>data-remote=\"true\"<\/code>.<\/p>\n<pre class=\"wp-block-preformatted brush:html\">&lt;a href=\"\/articles\/42?delete\" data-remote=\"true\"\n    data-method=\"delete\"\n    data-confirm=\"Are you sure?\"&gt;Delete&lt;\/a&gt;<\/pre>\n<p>When the link is clicked, jQuery UJS will again send the <code>DELETE<\/code> request. But this time, it will be sent asynchronously using Ajax. Doing so enables the browser not to reload the entire page. And depending on the server\u2019s response, can update just a portion of the page. Thus, providing a slightly better user experience.<\/p>\n<p>For the server-side controller, we need to send a different response when the request is expecting <code>text\/javascript<\/code>. We add a handler method that will respond with <code>text\/javascript<\/code> by using the <code>produces<\/code> element of <code>@RequestMapping<\/code>. The response will remove the related HTML element(s).<\/p>\n<pre class=\"wp-block-preformatted brush:java\">\/\/ inside a @Controller\n@DeleteMapping(path=\"\/articles\/{id}\")\nString delete(... id) {\n    \/\/ ... delete article with given identifier\n    return \"redirect:\/articles\";\n}\n\n@DeleteMapping(path=\"\/articles\/{id}\",\n    produces=\"text\/javascript\")\nString delete(... id) {\n    \/\/ ... delete article with given identifier\n    return \"articles\/delete\";\n}<\/pre>\n<p>The view is a JSP that contains <code>text\/javascript<\/code>. This will be executed by jQuery UJS.<\/p>\n<pre class=\"wp-block-preformatted brush:html\">&lt;%-- articles\/delete.js.jsp --%&gt;\n&lt;%@ page contentType=\"text\/javascript\" %&gt;\n$('#article:${id}').remove();<\/pre>\n<h3 class=\"wp-block-heading\">Partials and Server-generated JavaScript Responses<\/h3>\n<p>Now what happens if we wanted to have an edit link to get some HTML content and show it up in a modal (without a page refresh)?<\/p>\n<p>Here&#8217;s what we can do. We send a <code>GET<\/code> request asynchronously. The response is expected to contain JavaScript that would append the HTML in targeted places in the document, and then trigger the modal to appear.<\/p>\n<pre class=\"wp-block-preformatted brush:html\">&lt;a href=\"\/articles\/42?edit\" data-remote=\"true\"&gt;Edit&lt;\/a&gt;<\/pre>\n<p>When the response is expected to be <code>text\/javascript<\/code>, <code>articles\/edit.js.jsp<\/code> is rendered. Otherwise, the usual <code>articles\/edit.jsp<\/code> is rendered.<\/p>\n<pre class=\"wp-block-preformatted brush:java\">\/\/ inside a @Controller\n@GetMapping(path=\"\/articles\/{id}\", params={\"edit\"})\nString edit(... id, ...) {\n    \/\/ ...\n    return \"articles\/edit\";\n}\n\n@GetMapping(path=\"\/articles\/{id}\", params={\"edit\"},\n    produces=\"text\/javascript\")\nString editViaAjax(... id, ...) {\n    \/\/ ...\n    return \"articles\/edit\";\n}<\/pre>\n<p>The <code>edit.jsp<\/code> renders the <code>&lt;form&gt;<\/code> (a partial, not a complete HTML document) which has been refactored to its own JSP to avoid repetition.<\/p>\n<pre class=\"wp-block-preformatted brush:html\">&lt;%-- articles\/edit.jsp --%&gt;\n&lt;!-- --&gt;\n  &lt;jsp:include page=\"_form.jsp\" \/&gt;\n&lt;!-- --&gt;<\/pre>\n<p>The <code>edit.js.jsp<\/code> renders the same <code>&lt;form&gt;<\/code> (a partial, not a complete HTML document) as a string in JS. Then includes it in the modal. It was tricky to render <code>_form.jsp<\/code> as a string. I had to use <code>&lt;c:import&gt;<\/code>.<\/p>\n<pre class=\"wp-block-preformatted brush:html\">&lt;%-- articles\/edit.js.jsp --%&gt;\n&lt;%@ page contentType=\"text\/javascript\" %&gt;\n&lt;c:import var=\"html\" url=\"\u2026_form.jsp\" \/&gt;\n&lt;!-- escape double quotes and remove new lines --&gt;\n(function() {\n  const $modal = $('#...'); \/\/ ID of modal element\n  $modal.find('.modal-body').html('${html}');\n  if (!$modal.is(':visible')) {\n    $modal.modal('show');\n  }\n})()<\/pre>\n<p>For this to work, another <code>InternalResourceViewResolver<\/code> (IRVR) bean with <code>text\/javascript<\/code> as the <code>contentType<\/code> is configured. This bean uses the same prefix and a slightly different suffix: <code>.js.jsp<\/code>. That way, when the request is expecting <code>text\/javascript<\/code>, the <abbr>CNVR<\/abbr> will favor using the IRVR bean with <code>text\/javascript<\/code> and it ends up rendering <code>articles\/edit.js.jsp<\/code>.<\/p>\n<h3 class=\"wp-block-heading\">Ajax Forms<\/h3>\n<p>The <code>data-remote=\"true\"<\/code> attribute can also be applied to <code>&lt;form&gt;<\/code>s. With it, jQuery UJS will handle the form submission as an Ajax request. And when the form is being submitted, the buttons can be disabled by adding <code>data-disabled-with<\/code>. For example,<\/p>\n<pre class=\"wp-block-preformatted brush:html\">&lt;form ...&gt;\n  &lt;!-- ... --&gt;\n  &lt;button data-disable-with=\"Saving...\"&gt;Save&lt;\/button&gt;\n&lt;\/form ...&gt;<\/pre>\n<p>When the above form is submitted, jQuery UJS will disable the button and change its content to &#8220;Saving&#8230;&#8221;.<\/p>\n<h3 class=\"wp-block-heading\">Closing Thoughts<\/h3>\n<p>I\u2019ve barely touched the surface of <a href=\"https:\/\/github.com\/rails\/jquery-ujs\">Rails\u2019 jQuery UJS<\/a>. There is so much more that it can offer. I look forward to using it (and similar techniques) in my web apps.<\/p>\n<div class=\"attribution\">\n<table>\n<tbody>\n<tr>\n<td>\n<p>Published on Java Code Geeks with permission by Lorenzo Dee, partner at our <a href=\"\/\/www.javacodegeeks.com\/join-us\/jcg\/\" target=\"_blank\" rel=\"noopener noreferrer\">JCG program<\/a>. See the original article here: <a href=\"http:\/\/lorenzo-dee.blogspot.com\/2019\/06\/spring-with-rails-jquery-ujs.html\" target=\"_blank\" rel=\"noopener noreferrer\">Spring with Rails&#8217; jQuery UJS<\/a><\/p>\n<p>Opinions expressed by Java Code Geeks contributors are their own.<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>I\u2019ve always wanted to try to see if I could use Rails\u2019 jQuery UJS in a Spring Boot project. The UJS in jquery-ujs stands for unobtrusive JavaScript. I really like how UJS wires event handlers to eligible DOM elements marked with HTML5 data-* attributes. I find myself wanting to see more of this approach being &hellip;<\/p>\n","protected":false},"author":998,"featured_media":20900,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[803,209,1912,30,854,150],"class_list":["post-93656","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-enterprise-java","tag-javascript","tag-jquery","tag-rails","tag-spring","tag-spring-boot","tag-spring-mvc"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Spring with Rails&#039; jQuery UJS - Java Code Geeks<\/title>\n<meta name=\"description\" content=\"Interested to learn about Rails&#039; jQuery UJS? Check our article explaining how to use use Rails\u2019 jQuery UJS in a Spring Boot project.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.javacodegeeks.com\/2019\/06\/spring-with-rails-jquery-ujs.html\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Spring with Rails&#039; jQuery UJS - Java Code Geeks\" \/>\n<meta property=\"og:description\" content=\"Interested to learn about Rails&#039; jQuery UJS? Check our article explaining how to use use Rails\u2019 jQuery UJS in a Spring Boot project.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.javacodegeeks.com\/2019\/06\/spring-with-rails-jquery-ujs.html\" \/>\n<meta property=\"og:site_name\" content=\"Java Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/javacodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2019-06-28T07:00:15+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2014\/01\/javascript-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Lorenzo Dee\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Lorenzo Dee\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/06\\\/spring-with-rails-jquery-ujs.html#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/06\\\/spring-with-rails-jquery-ujs.html\"},\"author\":{\"name\":\"Lorenzo Dee\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/cbe847ac79d631cc30453be020e1c923\"},\"headline\":\"Spring with Rails&#8217; jQuery UJS\",\"datePublished\":\"2019-06-28T07:00:15+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/06\\\/spring-with-rails-jquery-ujs.html\"},\"wordCount\":914,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/06\\\/spring-with-rails-jquery-ujs.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2014\\\/01\\\/javascript-logo.jpg\",\"keywords\":[\"JavaScript\",\"jQuery\",\"Rails\",\"Spring\",\"Spring Boot\",\"Spring MVC\"],\"articleSection\":[\"Enterprise Java\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/06\\\/spring-with-rails-jquery-ujs.html#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/06\\\/spring-with-rails-jquery-ujs.html\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/06\\\/spring-with-rails-jquery-ujs.html\",\"name\":\"Spring with Rails' jQuery UJS - Java Code Geeks\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/06\\\/spring-with-rails-jquery-ujs.html#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/06\\\/spring-with-rails-jquery-ujs.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2014\\\/01\\\/javascript-logo.jpg\",\"datePublished\":\"2019-06-28T07:00:15+00:00\",\"description\":\"Interested to learn about Rails' jQuery UJS? Check our article explaining how to use use Rails\u2019 jQuery UJS in a Spring Boot project.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/06\\\/spring-with-rails-jquery-ujs.html#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/06\\\/spring-with-rails-jquery-ujs.html\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/06\\\/spring-with-rails-jquery-ujs.html#primaryimage\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2014\\\/01\\\/javascript-logo.jpg\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2014\\\/01\\\/javascript-logo.jpg\",\"width\":150,\"height\":150},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2019\\\/06\\\/spring-with-rails-jquery-ujs.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Java\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/java\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Enterprise Java\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/java\\\/enterprise-java\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Spring with Rails&#8217; jQuery UJS\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"name\":\"Java Code Geeks\",\"description\":\"Java Developers Resource Center\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"alternateName\":\"JCG\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.javacodegeeks.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/javacodegeeks\",\"https:\\\/\\\/x.com\\\/javacodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/cbe847ac79d631cc30453be020e1c923\",\"name\":\"Lorenzo Dee\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/b52de1a36cee22cee60fc7e87232dde957d66b0f4cbcb50c23d58acbaaff4114?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/b52de1a36cee22cee60fc7e87232dde957d66b0f4cbcb50c23d58acbaaff4114?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/b52de1a36cee22cee60fc7e87232dde957d66b0f4cbcb50c23d58acbaaff4114?s=96&d=mm&r=g\",\"caption\":\"Lorenzo Dee\"},\"description\":\"Lorenzo is a software engineer, trainer, manager, and entrepreneur, who loves developing software systems that make people and organizations productive, profitable, and happy. He is a co-founder of the now dormant Haybol.ph, a Philippine real estate search site. He loves drinking coffee, root beer, and milk shakes.\",\"sameAs\":[\"http:\\\/\\\/lorenzo-dee.blogspot.gr\\\/\"],\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/author\\\/lorenzo-dee\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Spring with Rails' jQuery UJS - Java Code Geeks","description":"Interested to learn about Rails' jQuery UJS? Check our article explaining how to use use Rails\u2019 jQuery UJS in a Spring Boot project.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.javacodegeeks.com\/2019\/06\/spring-with-rails-jquery-ujs.html","og_locale":"en_US","og_type":"article","og_title":"Spring with Rails' jQuery UJS - Java Code Geeks","og_description":"Interested to learn about Rails' jQuery UJS? Check our article explaining how to use use Rails\u2019 jQuery UJS in a Spring Boot project.","og_url":"https:\/\/www.javacodegeeks.com\/2019\/06\/spring-with-rails-jquery-ujs.html","og_site_name":"Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2019-06-28T07:00:15+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2014\/01\/javascript-logo.jpg","type":"image\/jpeg"}],"author":"Lorenzo Dee","twitter_card":"summary_large_image","twitter_creator":"@javacodegeeks","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Lorenzo Dee","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.javacodegeeks.com\/2019\/06\/spring-with-rails-jquery-ujs.html#article","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/2019\/06\/spring-with-rails-jquery-ujs.html"},"author":{"name":"Lorenzo Dee","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/cbe847ac79d631cc30453be020e1c923"},"headline":"Spring with Rails&#8217; jQuery UJS","datePublished":"2019-06-28T07:00:15+00:00","mainEntityOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2019\/06\/spring-with-rails-jquery-ujs.html"},"wordCount":914,"commentCount":0,"publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2019\/06\/spring-with-rails-jquery-ujs.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2014\/01\/javascript-logo.jpg","keywords":["JavaScript","jQuery","Rails","Spring","Spring Boot","Spring MVC"],"articleSection":["Enterprise Java"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.javacodegeeks.com\/2019\/06\/spring-with-rails-jquery-ujs.html#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.javacodegeeks.com\/2019\/06\/spring-with-rails-jquery-ujs.html","url":"https:\/\/www.javacodegeeks.com\/2019\/06\/spring-with-rails-jquery-ujs.html","name":"Spring with Rails' jQuery UJS - Java Code Geeks","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2019\/06\/spring-with-rails-jquery-ujs.html#primaryimage"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2019\/06\/spring-with-rails-jquery-ujs.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2014\/01\/javascript-logo.jpg","datePublished":"2019-06-28T07:00:15+00:00","description":"Interested to learn about Rails' jQuery UJS? Check our article explaining how to use use Rails\u2019 jQuery UJS in a Spring Boot project.","breadcrumb":{"@id":"https:\/\/www.javacodegeeks.com\/2019\/06\/spring-with-rails-jquery-ujs.html#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.javacodegeeks.com\/2019\/06\/spring-with-rails-jquery-ujs.html"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/2019\/06\/spring-with-rails-jquery-ujs.html#primaryimage","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2014\/01\/javascript-logo.jpg","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2014\/01\/javascript-logo.jpg","width":150,"height":150},{"@type":"BreadcrumbList","@id":"https:\/\/www.javacodegeeks.com\/2019\/06\/spring-with-rails-jquery-ujs.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.javacodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"Java","item":"https:\/\/www.javacodegeeks.com\/category\/java"},{"@type":"ListItem","position":3,"name":"Enterprise Java","item":"https:\/\/www.javacodegeeks.com\/category\/java\/enterprise-java"},{"@type":"ListItem","position":4,"name":"Spring with Rails&#8217; jQuery UJS"}]},{"@type":"WebSite","@id":"https:\/\/www.javacodegeeks.com\/#website","url":"https:\/\/www.javacodegeeks.com\/","name":"Java Code Geeks","description":"Java Developers Resource Center","publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"alternateName":"JCG","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.javacodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.javacodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/www.javacodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/javacodegeeks","https:\/\/x.com\/javacodegeeks"]},{"@type":"Person","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/cbe847ac79d631cc30453be020e1c923","name":"Lorenzo Dee","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/b52de1a36cee22cee60fc7e87232dde957d66b0f4cbcb50c23d58acbaaff4114?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/b52de1a36cee22cee60fc7e87232dde957d66b0f4cbcb50c23d58acbaaff4114?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/b52de1a36cee22cee60fc7e87232dde957d66b0f4cbcb50c23d58acbaaff4114?s=96&d=mm&r=g","caption":"Lorenzo Dee"},"description":"Lorenzo is a software engineer, trainer, manager, and entrepreneur, who loves developing software systems that make people and organizations productive, profitable, and happy. He is a co-founder of the now dormant Haybol.ph, a Philippine real estate search site. He loves drinking coffee, root beer, and milk shakes.","sameAs":["http:\/\/lorenzo-dee.blogspot.gr\/"],"url":"https:\/\/www.javacodegeeks.com\/author\/lorenzo-dee"}]}},"_links":{"self":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/93656","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/users\/998"}],"replies":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=93656"}],"version-history":[{"count":0,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/93656\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media\/20900"}],"wp:attachment":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media?parent=93656"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=93656"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=93656"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}