Grails UrlMappings with a URL ending in "/"

I have the following UrlMapping in my Grails UrlMappings class:

  "/$something/" {
      controller = "controllerName"
      action = "actionName"
      constraints {
      }
  }

Requests of both "/ foobar /" and "/ foobar" are routed to the correct controller and action.

However, the URL: s created using g: link does not end with a slash ("/") as expected.

GSP Code ...

<g:link controller="controllerName" action="actionName" params="[something: 'foobar']">...</g:link>

... generates HTML output ...

<a href="/foobar">...</a>

How to get Grails to create the link specified in the URL pattern? This includes the trailing slash.

+3
source share
1 answer

, URL- Grails . . Grails. .

(, ) :

<g:link uri="/foobar/">Foo Link</g:link>

.

+1

Source: https://habr.com/ru/post/1704515/


All Articles