{"id":2723,"date":"2011-02-14T21:11:46","date_gmt":"2011-02-14T15:41:46","guid":{"rendered":"https:\/\/tothenewco.pro\/blog\/?p=2723"},"modified":"2022-01-12T19:01:59","modified_gmt":"2022-01-12T13:31:59","slug":"using-taglib-to-avoid-changes-due-to-change-in-urlmappings","status":"publish","type":"post","link":"https:\/\/tothenewco.pro\/blog\/using-taglib-to-avoid-changes-due-to-change-in-urlmappings\/","title":{"rendered":"Using TagLib to avoid changes due to change in URLMappings"},"content":{"rendered":"<p>Recently, I used Taglib to centralize the effect of URL mapping related changes of my grails application.<\/p>\n<p>[java]<br \/>\ndef userPageLink = {attrs, body -&gt;<\/p>\n<p>def user = User.read(attrs.id)<\/p>\n<p>out &lt;&lt; g.link(controller: &#8216;user&#8217;, action: &#8216;show&#8217;, params: [name: user.name]) {body()}<br \/>\n}<br \/>\n[\/java]<\/p>\n<p>So wherever I need a link to user page, I can use this Taglib instead of g:link.<\/p>\n<p>[java]<br \/>\n&lt;hys:userPageLink id=&quot;${user.id}&quot;&gt;${user.name}&lt;\/hys:userPageLink&gt;<br \/>\n[\/java]<\/p>\n<p><strong>Advantage:<\/strong><\/p>\n<p><\/br>Whenever I change the URL Mappings, there is no need to update all the g:link in all my gsp files. I would just update my taglib to cater to new URL Mapping.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Recently, I used Taglib to centralize the effect of URL mapping related changes of my grails application. [java] def userPageLink = {attrs, body -&gt; def user = User.read(attrs.id) out &lt;&lt; g.link(controller: &#8216;user&#8217;, action: &#8216;show&#8217;, params: [name: user.name]) {body()} } [\/java] So wherever I need a link to user page, I can use this Taglib instead [&hellip;]<\/p>\n","protected":false},"author":26,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":2,"footnotes":""},"categories":[7],"tags":[4840,213,32,50],"class_list":["post-2723","post","type-post","status-publish","format-standard","hentry","category-grails","tag-grails","tag-grails-taglib","tag-gsp","tag-url-mappings"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.0.1 - aioseo.com -->\n\t<meta name=\"description\" content=\"Recently, I used Taglib to centralize the effect of URL mapping related changes of my grails application. [java] def userPageLink = {attrs, body -&gt; def user = User.read(attrs.id) out\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Mohd Farid\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/tothenewco.pro\/blog\/using-taglib-to-avoid-changes-due-to-change-in-urlmappings\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.0.1\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"TO THE NEW BLOG\" \/>\n\t\t<meta property=\"og:type\" content=\"blog\" \/>\n\t\t<meta property=\"og:title\" content=\"Using TagLib to avoid changes due to change in URLMappings | TO THE NEW Blog\" \/>\n\t\t<meta property=\"og:description\" content=\"Recently, I used Taglib to centralize the effect of URL mapping related changes of my grails application. [java] def userPageLink = {attrs, body -&gt; def user = User.read(attrs.id) out\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/tothenewco.pro\/blog\/using-taglib-to-avoid-changes-due-to-change-in-urlmappings\/\" \/>\n\t\t<meta property=\"og:image\" content=\"https:\/\/tothenewco.pro\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png\" \/>\n\t\t<meta property=\"og:image:secure_url\" content=\"https:\/\/tothenewco.pro\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:site\" content=\"@tothenew\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Using TagLib to avoid changes due to change in URLMappings | TO THE NEW Blog\" \/>\n\t\t<meta name=\"twitter:description\" content=\"Recently, I used Taglib to centralize the effect of URL mapping related changes of my grails application. [java] def userPageLink = {attrs, body -&gt; def user = User.read(attrs.id) out\" \/>\n\t\t<meta name=\"twitter:image\" content=\"https:\/\/tothenewco.pro\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/using-taglib-to-avoid-changes-due-to-change-in-urlmappings\\\/#article\",\"name\":\"Using TagLib to avoid changes due to change in URLMappings | TO THE NEW Blog\",\"headline\":\"Using TagLib to avoid changes due to change in URLMappings\",\"author\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/farid\\\/#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#organization\"},\"datePublished\":\"2011-02-14T21:11:46+05:30\",\"dateModified\":\"2022-01-12T19:01:59+05:30\",\"inLanguage\":\"en-US\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/using-taglib-to-avoid-changes-due-to-change-in-urlmappings\\\/#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/using-taglib-to-avoid-changes-due-to-change-in-urlmappings\\\/#webpage\"},\"articleSection\":\"Grails, Grails, grails taglib, gsp, url mappings\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/using-taglib-to-avoid-changes-due-to-change-in-urlmappings\\\/#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.tothenew.com\\\/blog\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/category\\\/grails\\\/#listItem\",\"name\":\"Grails\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/category\\\/grails\\\/#listItem\",\"position\":2,\"name\":\"Grails\",\"item\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/category\\\/grails\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/using-taglib-to-avoid-changes-due-to-change-in-urlmappings\\\/#listItem\",\"name\":\"Using TagLib to avoid changes due to change in URLMappings\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/using-taglib-to-avoid-changes-due-to-change-in-urlmappings\\\/#listItem\",\"position\":3,\"name\":\"Using TagLib to avoid changes due to change in URLMappings\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/category\\\/grails\\\/#listItem\",\"name\":\"Grails\"}}]},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#organization\",\"name\":\"TO THE NEW Blog\",\"url\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/farid\\\/#author\",\"url\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/farid\\\/\",\"name\":\"Mohd Farid\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/using-taglib-to-avoid-changes-due-to-change-in-urlmappings\\\/#authorImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/d386ff6714165be4c5ee1f75fd255d6ca7021e0ada16952088cff7e9f6e50679?s=96&d=mm&r=g\",\"width\":96,\"height\":96,\"caption\":\"Mohd Farid\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/using-taglib-to-avoid-changes-due-to-change-in-urlmappings\\\/#webpage\",\"url\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/using-taglib-to-avoid-changes-due-to-change-in-urlmappings\\\/\",\"name\":\"Using TagLib to avoid changes due to change in URLMappings | TO THE NEW Blog\",\"description\":\"Recently, I used Taglib to centralize the effect of URL mapping related changes of my grails application. [java] def userPageLink = {attrs, body -> def user = User.read(attrs.id) out\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/using-taglib-to-avoid-changes-due-to-change-in-urlmappings\\\/#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/farid\\\/#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/farid\\\/#author\"},\"datePublished\":\"2011-02-14T21:11:46+05:30\",\"dateModified\":\"2022-01-12T19:01:59+05:30\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/\",\"name\":\"TO THE NEW Blog\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#organization\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"Using TagLib to avoid changes due to change in URLMappings | TO THE NEW Blog","description":"Recently, I used Taglib to centralize the effect of URL mapping related changes of my grails application. [java] def userPageLink = {attrs, body -> def user = User.read(attrs.id) out","canonical_url":"https:\/\/tothenewco.pro\/blog\/using-taglib-to-avoid-changes-due-to-change-in-urlmappings\/","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/tothenewco.pro\/blog\/using-taglib-to-avoid-changes-due-to-change-in-urlmappings\/#article","name":"Using TagLib to avoid changes due to change in URLMappings | TO THE NEW Blog","headline":"Using TagLib to avoid changes due to change in URLMappings","author":{"@id":"https:\/\/tothenewco.pro\/blog\/author\/farid\/#author"},"publisher":{"@id":"https:\/\/tothenewco.pro\/blog\/#organization"},"datePublished":"2011-02-14T21:11:46+05:30","dateModified":"2022-01-12T19:01:59+05:30","inLanguage":"en-US","mainEntityOfPage":{"@id":"https:\/\/tothenewco.pro\/blog\/using-taglib-to-avoid-changes-due-to-change-in-urlmappings\/#webpage"},"isPartOf":{"@id":"https:\/\/tothenewco.pro\/blog\/using-taglib-to-avoid-changes-due-to-change-in-urlmappings\/#webpage"},"articleSection":"Grails, Grails, grails taglib, gsp, url mappings"},{"@type":"BreadcrumbList","@id":"https:\/\/tothenewco.pro\/blog\/using-taglib-to-avoid-changes-due-to-change-in-urlmappings\/#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/tothenewco.pro\/blog#listItem","position":1,"name":"Home","item":"https:\/\/tothenewco.pro\/blog","nextItem":{"@type":"ListItem","@id":"https:\/\/tothenewco.pro\/blog\/category\/grails\/#listItem","name":"Grails"}},{"@type":"ListItem","@id":"https:\/\/tothenewco.pro\/blog\/category\/grails\/#listItem","position":2,"name":"Grails","item":"https:\/\/tothenewco.pro\/blog\/category\/grails\/","nextItem":{"@type":"ListItem","@id":"https:\/\/tothenewco.pro\/blog\/using-taglib-to-avoid-changes-due-to-change-in-urlmappings\/#listItem","name":"Using TagLib to avoid changes due to change in URLMappings"},"previousItem":{"@type":"ListItem","@id":"https:\/\/tothenewco.pro\/blog#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/tothenewco.pro\/blog\/using-taglib-to-avoid-changes-due-to-change-in-urlmappings\/#listItem","position":3,"name":"Using TagLib to avoid changes due to change in URLMappings","previousItem":{"@type":"ListItem","@id":"https:\/\/tothenewco.pro\/blog\/category\/grails\/#listItem","name":"Grails"}}]},{"@type":"Organization","@id":"https:\/\/tothenewco.pro\/blog\/#organization","name":"TO THE NEW Blog","url":"https:\/\/tothenewco.pro\/blog\/"},{"@type":"Person","@id":"https:\/\/tothenewco.pro\/blog\/author\/farid\/#author","url":"https:\/\/tothenewco.pro\/blog\/author\/farid\/","name":"Mohd Farid","image":{"@type":"ImageObject","@id":"https:\/\/tothenewco.pro\/blog\/using-taglib-to-avoid-changes-due-to-change-in-urlmappings\/#authorImage","url":"https:\/\/secure.gravatar.com\/avatar\/d386ff6714165be4c5ee1f75fd255d6ca7021e0ada16952088cff7e9f6e50679?s=96&d=mm&r=g","width":96,"height":96,"caption":"Mohd Farid"}},{"@type":"WebPage","@id":"https:\/\/tothenewco.pro\/blog\/using-taglib-to-avoid-changes-due-to-change-in-urlmappings\/#webpage","url":"https:\/\/tothenewco.pro\/blog\/using-taglib-to-avoid-changes-due-to-change-in-urlmappings\/","name":"Using TagLib to avoid changes due to change in URLMappings | TO THE NEW Blog","description":"Recently, I used Taglib to centralize the effect of URL mapping related changes of my grails application. [java] def userPageLink = {attrs, body -> def user = User.read(attrs.id) out","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/tothenewco.pro\/blog\/#website"},"breadcrumb":{"@id":"https:\/\/tothenewco.pro\/blog\/using-taglib-to-avoid-changes-due-to-change-in-urlmappings\/#breadcrumblist"},"author":{"@id":"https:\/\/tothenewco.pro\/blog\/author\/farid\/#author"},"creator":{"@id":"https:\/\/tothenewco.pro\/blog\/author\/farid\/#author"},"datePublished":"2011-02-14T21:11:46+05:30","dateModified":"2022-01-12T19:01:59+05:30"},{"@type":"WebSite","@id":"https:\/\/tothenewco.pro\/blog\/#website","url":"https:\/\/tothenewco.pro\/blog\/","name":"TO THE NEW Blog","inLanguage":"en-US","publisher":{"@id":"https:\/\/tothenewco.pro\/blog\/#organization"}}]},"og:locale":"en_US","og:site_name":"TO THE NEW BLOG","og:type":"blog","og:title":"Using TagLib to avoid changes due to change in URLMappings | TO THE NEW Blog","og:description":"Recently, I used Taglib to centralize the effect of URL mapping related changes of my grails application. [java] def userPageLink = {attrs, body -&gt; def user = User.read(attrs.id) out","og:url":"https:\/\/tothenewco.pro\/blog\/using-taglib-to-avoid-changes-due-to-change-in-urlmappings\/","og:image":"https:\/\/tothenewco.pro\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png","og:image:secure_url":"https:\/\/tothenewco.pro\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png","twitter:card":"summary","twitter:site":"@tothenew","twitter:title":"Using TagLib to avoid changes due to change in URLMappings | TO THE NEW Blog","twitter:description":"Recently, I used Taglib to centralize the effect of URL mapping related changes of my grails application. [java] def userPageLink = {attrs, body -&gt; def user = User.read(attrs.id) out","twitter:image":"https:\/\/tothenewco.pro\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png"},"aioseo_meta_data":{"post_id":"2723","title":null,"description":null,"keywords":[],"keyphrases":{"focus":[],"additional":[]},"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":"","og_custom_url":null,"og_article_section":null,"og_article_tags":[],"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":{"id":"#aioseo-article-65e046422b587","slug":"article","graphName":"Article","label":"Article","properties":{"type":"BlogPosting","name":"#post_title","headline":"#post_title","description":"#post_excerpt","image":"","keywords":"","author":{"name":"#author_name","url":"#author_url"},"dates":{"include":true,"datePublished":"","dateModified":""}}},"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"Article","isEnabled":true},"graphs":[]},"schema_type":"default","schema_type_options":"{\"article\":{\"articleType\":\"BlogPosting\"},\"course\":{\"name\":\"\",\"description\":\"\",\"provider\":\"\"},\"faq\":{\"pages\":[]},\"product\":{\"reviews\":[]},\"recipe\":{\"ingredients\":[],\"instructions\":[],\"keywords\":[]},\"software\":{\"reviews\":[],\"operatingSystems\":[]},\"webPage\":{\"webPageType\":\"WebPage\"}}","pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":"-1","robots_max_videopreview":"-1","robots_max_imagepreview":"large","priority":null,"frequency":"default","local_seo":null,"limit_modified_date":false,"created":"2021-04-29 13:53:20","updated":"2024-02-29 08:54:26","focus_keyword":null,"additional_keywords":null,"truseo_locale":null,"ai":null,"breadcrumb_settings":null,"seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/tothenewco.pro\/blog\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/tothenewco.pro\/blog\/category\/grails\/\" title=\"Grails\">Grails<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tUsing TagLib to avoid changes due to change in URLMappings\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/tothenewco.pro\/blog"},{"label":"Grails","link":"https:\/\/tothenewco.pro\/blog\/category\/grails\/"},{"label":"Using TagLib to avoid changes due to change in URLMappings","link":"https:\/\/tothenewco.pro\/blog\/using-taglib-to-avoid-changes-due-to-change-in-urlmappings\/"}],"_links":{"self":[{"href":"https:\/\/tothenewco.pro\/blog\/wp-json\/wp\/v2\/posts\/2723","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tothenewco.pro\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tothenewco.pro\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tothenewco.pro\/blog\/wp-json\/wp\/v2\/users\/26"}],"replies":[{"embeddable":true,"href":"https:\/\/tothenewco.pro\/blog\/wp-json\/wp\/v2\/comments?post=2723"}],"version-history":[{"count":1,"href":"https:\/\/tothenewco.pro\/blog\/wp-json\/wp\/v2\/posts\/2723\/revisions"}],"predecessor-version":[{"id":54612,"href":"https:\/\/tothenewco.pro\/blog\/wp-json\/wp\/v2\/posts\/2723\/revisions\/54612"}],"wp:attachment":[{"href":"https:\/\/tothenewco.pro\/blog\/wp-json\/wp\/v2\/media?parent=2723"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tothenewco.pro\/blog\/wp-json\/wp\/v2\/categories?post=2723"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tothenewco.pro\/blog\/wp-json\/wp\/v2\/tags?post=2723"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}