From d3b920c2c4240080c532f3e5f2339a578ae4996e Mon Sep 17 00:00:00 2001 From: Puneet Behl Date: Wed, 29 Nov 2023 16:33:20 +0530 Subject: [PATCH 01/43] Update dependabot.yml --- .github/dependabot.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index d39bf559ab..9c4d303d8e 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -11,3 +11,14 @@ updates: update-types: ["version-update:semver-minor", "version-update:semver-major"] labels: - "type: dependency upgrade" +- package-ecosystem: gradle + directory: "/" + schedule: + interval: daily + open-pull-requests-limit: 10 + target-branch: 7.0.x + ignore: + - dependency-name: "*" + update-types: ["version-update:semver-patch"] + labels: + - "type: dependency upgrade" From 3f33f7362c087ccd0a202ca8042ad7f8bb31016b Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 7 Dec 2023 14:39:44 +0530 Subject: [PATCH 02/43] Update plugin com.gradle.common-custom-user-data-gradle-plugin to v1.12.1 (#395) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- settings.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/settings.gradle b/settings.gradle index 7973d4dbe3..bb906f900d 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,6 +1,6 @@ plugins { id "com.gradle.enterprise" version "3.15.1" - id 'com.gradle.common-custom-user-data-gradle-plugin' version '1.12' + id 'com.gradle.common-custom-user-data-gradle-plugin' version '1.12.1' } gradleEnterprise { From 427116dff5b9c33b72d91b25c6488c883b648f07 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 7 Dec 2023 14:40:11 +0530 Subject: [PATCH 03/43] Update actions/setup-java action to v4 (#393) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/gradle.yml | 2 +- .github/workflows/release.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index d14e0ae381..7a75a4ddad 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -20,7 +20,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: Set up JDK - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: distribution: 'adopt' java-version: ${{ matrix.java }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f381a059ed..004203c49b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -18,7 +18,7 @@ jobs: token: ${{ secrets.GH_TOKEN }} - uses: gradle/wrapper-validation-action@v1 - name: Set up JDK - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: distribution: 'adopt' java-version: ${{ matrix.java }} From 30ac4c68b2c96cace7e3774bb98f84196d431472 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 8 Dec 2023 00:41:38 +0530 Subject: [PATCH 04/43] Update plugin com.gradle.enterprise to v3.16 (#394) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- settings.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/settings.gradle b/settings.gradle index bb906f900d..35b9f7d6a0 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,5 +1,5 @@ plugins { - id "com.gradle.enterprise" version "3.15.1" + id "com.gradle.enterprise" version "3.16" id 'com.gradle.common-custom-user-data-gradle-plugin' version '1.12.1' } From ed2c76b19592b11560f80bab648ed4f2b04508e2 Mon Sep 17 00:00:00 2001 From: Mattias Reichel Date: Thu, 7 Dec 2023 20:11:55 +0100 Subject: [PATCH 05/43] Make project compatible with Groovy 3.0.19 (#389) * Update to, and make project compatible with, Groovy 3.0.19 * Revert to Groovy 3.0.11 --- .../org/grails/gsp/compiler/GroovyPageCompiler.groovy | 6 +++--- .../org/grails/web/pages/GroovyPageCompilerForkTask.groovy | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/grails-gsp/src/main/groovy/org/grails/gsp/compiler/GroovyPageCompiler.groovy b/grails-gsp/src/main/groovy/org/grails/gsp/compiler/GroovyPageCompiler.groovy index 2094afafb5..46209a6ca0 100644 --- a/grails-gsp/src/main/groovy/org/grails/gsp/compiler/GroovyPageCompiler.groovy +++ b/grails-gsp/src/main/groovy/org/grails/gsp/compiler/GroovyPageCompiler.groovy @@ -112,9 +112,9 @@ class GroovyPageCompiler { for(int index = 0; index < collatedSrcFiles.size(); index++) { def gspFiles = collatedSrcFiles[index] - futures << completionService.submit({ -> + futures.add(completionService.submit({ -> def results = [:] - for(int gspIndex=0;gspIndex < gspFiles.size();gspIndex++) { + for(int gspIndex = 0; gspIndex < gspFiles.size(); gspIndex++) { File gsp = gspFiles[gspIndex] try { compileGSP(viewsDir, gsp, viewPrefix, packagePrefix, results) @@ -124,7 +124,7 @@ class GroovyPageCompiler { } } return results - } as Callable) + } as Callable) as Future) } int pending = futures.size() diff --git a/grails-web-gsp/src/main/groovy/org/grails/web/pages/GroovyPageCompilerForkTask.groovy b/grails-web-gsp/src/main/groovy/org/grails/web/pages/GroovyPageCompilerForkTask.groovy index 9c458558f5..cca4668846 100644 --- a/grails-web-gsp/src/main/groovy/org/grails/web/pages/GroovyPageCompilerForkTask.groovy +++ b/grails-web-gsp/src/main/groovy/org/grails/web/pages/GroovyPageCompilerForkTask.groovy @@ -116,7 +116,7 @@ Usage: java -cp CLASSPATH GroovyPageCompilerForkTask [srcDir] [destDir] [tmpDir] String targetCompatibility = args[3] String packageName = args[4].trim() String serverpath = args[5] - String[] configFiles = args[6].tokenize(',') + String[] configFiles = args[6].tokenize(',') as String[] File configFile = new File(args[6]) String encoding = args[7] ?: 'UTF-8' From dc0270b4d11ef8526825313ac071bd1bc4270c1f Mon Sep 17 00:00:00 2001 From: Puneet Behl Date: Fri, 8 Dec 2023 01:07:40 +0530 Subject: [PATCH 06/43] Update gradle.yml (#397) - Breakdown into multiple jobs - Use actions/uploadArtifact to upload artifacts --- .github/workflows/gradle.yml | 59 +++++++++++++++++++++++------------- 1 file changed, 38 insertions(+), 21 deletions(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 7a75a4ddad..3035ca2363 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -2,21 +2,21 @@ name: Java CI on: push: branches: - - master - '[3-9]+.[0-9]+.x' pull_request: branches: - - master - '[3-9]+.[0-9]+.x' + workflow_dispatch: jobs: build: runs-on: ubuntu-latest + permissions: + contents: read strategy: matrix: java: ['11', '14', '17'] env: WORKSPACE: ${{ github.workspace }} - GRADLE_OPTS: -Xmx1500m -Dfile.encoding=UTF-8 steps: - uses: actions/checkout@v4 - name: Set up JDK @@ -24,14 +24,7 @@ jobs: with: distribution: 'adopt' java-version: ${{ matrix.java }} - - name: Run Tests - if: github.event_name == 'pull_request' - id: tests - uses: gradle/gradle-build-action@v2 - with: - arguments: check - name: Run Build - if: github.event_name == 'push' id: build uses: gradle/gradle-build-action@v2 env: @@ -40,8 +33,26 @@ jobs: GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY }} with: arguments: build + - name: Upload Artifacts + if: steps.build.outcome == 'success' && matrix.java == '11' + uses: actions/upload-artifact@v3 + with: + name: grails-gsp.zip + path: build/libs/grails-gsp-*.zip + publish: + if: github.event_name == 'push' + needs: build + runs-on: ubuntu-latest + permissions: + contents: read + steps: + - uses: actions/checkout@v4 + - name: Set up JDK + uses: actions/setup-java@v4 + with: + distribution: 'adopt' + java-version: '11' - name: Publish to repo.grails.org - if: steps.build.outcome == 'success' && github.event_name == 'push' && matrix.java == '11' uses: gradle/gradle-build-action@v2 env: GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} @@ -51,15 +62,21 @@ jobs: ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }} with: arguments: publish - - name: Publish Test Report - if: steps.build.outcome == 'failure' || steps.tests.outcome == 'failure' - uses: scacap/action-surefire-report@v1 + docs: + if: github.event_name == 'push' + needs: build + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - uses: actions/checkout@v4 + - name: Set up JDK + uses: actions/setup-java@v4 with: - github_token: ${{ secrets.GITHUB_TOKEN }} - report_paths: '**/build/test-results/test/TEST-*.xml' + distribution: 'adopt' + java-version: '11' - name: Build Docs id: docs - if: steps.build.outcome == 'success' && github.event_name == 'push' && matrix.java == '11' uses: gradle/gradle-build-action@v2 with: arguments: docs @@ -68,12 +85,12 @@ jobs: GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER }} GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY }} - name: Publish to Github Pages - if: steps.docs.outcome == 'success' && github.event_name == 'push' && matrix.java == '11' - uses: micronaut-projects/github-pages-deploy-action@master + if: steps.docs.outcome == 'success' + uses: grails/github-pages-deploy-action@v2 env: TARGET_REPOSITORY: ${{ github.repository }} GH_TOKEN: ${{ secrets.GH_TOKEN }} BRANCH: gh-pages FOLDER: build/docs - COMMIT_EMAIL: behlp@objectcomputing.com - COMMIT_NAME: Puneet Behl + COMMIT_EMAIL: behlp@unityfoundation.io + COMMIT_NAME: Puneet Behl \ No newline at end of file From 2510a54a1ff24c4ee9765696d23684893650955c Mon Sep 17 00:00:00 2001 From: Puneet Behl Date: Fri, 8 Dec 2023 01:12:26 +0530 Subject: [PATCH 07/43] Update gradle.yml Correct upload path to use JAR extension instead of ZIP --- .github/workflows/gradle.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 3035ca2363..4d8762e5fb 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -38,7 +38,7 @@ jobs: uses: actions/upload-artifact@v3 with: name: grails-gsp.zip - path: build/libs/grails-gsp-*.zip + path: build/libs/grails-gsp-*.jar publish: if: github.event_name == 'push' needs: build From 347587a5c38d04597d85e6c6d75509299236e0c1 Mon Sep 17 00:00:00 2001 From: Puneet Behl Date: Fri, 8 Dec 2023 01:15:53 +0530 Subject: [PATCH 08/43] Rename upload-artifact extension to JAR --- .github/workflows/gradle.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 4d8762e5fb..5d7f9f6a34 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -37,7 +37,7 @@ jobs: if: steps.build.outcome == 'success' && matrix.java == '11' uses: actions/upload-artifact@v3 with: - name: grails-gsp.zip + name: grails-gsp.jar path: build/libs/grails-gsp-*.jar publish: if: github.event_name == 'push' From c5142956da18eff60962e697a8389b8fec1ded07 Mon Sep 17 00:00:00 2001 From: puneetbehl Date: Fri, 8 Dec 2023 07:43:37 +0000 Subject: [PATCH 09/43] [skip ci] Release v6.1.2 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 26a516ffb0..ade23aee19 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,6 @@ title=Groovy Server Pages (GSP) authors=Puneet Behl -projectVersion=6.1.2-SNAPSHOT +projectVersion=6.1.2 projectDesc=GSP (Groovy Server Pages) - A server-side view rendering technology based on Groovy projectUrl=https://github.com/grails/grails-gsp githubSlug=grails/grails-gsp From c23a9425f69e545b18fd30c42a6d6b9047808ba5 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 13 Dec 2023 22:02:25 +0530 Subject: [PATCH 10/43] Update grails monorepo to v6.1.1 (#399) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index ade23aee19..5c97ed7806 100644 --- a/gradle.properties +++ b/gradle.properties @@ -7,7 +7,7 @@ githubSlug=grails/grails-gsp githubBranch=6.1.x developers=Puneet Behl, Graeme Rocher grailsGradlePluginVersion=6.1.0 -grailsVersion=6.1.0 +grailsVersion=6.1.1 groovyVersion=3.0.11 servletApiVersion=4.0.1 javaParserCoreVersion=3.15.14 From 565a25f42ede653ed3c5373be2be2052876d9975 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 15 Dec 2023 23:49:04 +0530 Subject: [PATCH 11/43] Update plugin com.gradle.enterprise to v3.16.1 (#402) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- settings.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/settings.gradle b/settings.gradle index 35b9f7d6a0..2b82751067 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,5 +1,5 @@ plugins { - id "com.gradle.enterprise" version "3.16" + id "com.gradle.enterprise" version "3.16.1" id 'com.gradle.common-custom-user-data-gradle-plugin' version '1.12.1' } From e9d69f9cd36862cb4c048fa97bbbc8ff6a497821 Mon Sep 17 00:00:00 2001 From: Mattias Reichel Date: Fri, 15 Dec 2023 19:19:14 +0100 Subject: [PATCH 12/43] Back to 6.1.3-SNAPSHOT (#401) --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 5c97ed7806..e1b08233d3 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,6 @@ title=Groovy Server Pages (GSP) authors=Puneet Behl -projectVersion=6.1.2 +projectVersion=6.1.3-SNAPSHOT projectDesc=GSP (Groovy Server Pages) - A server-side view rendering technology based on Groovy projectUrl=https://github.com/grails/grails-gsp githubSlug=grails/grails-gsp From 26ae0f7cd63e013a988318b46909ccd821b6beaa Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 15 Dec 2023 23:49:26 +0530 Subject: [PATCH 13/43] Update actions/upload-artifact action to v4 (#403) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/gradle.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 5d7f9f6a34..fd47fe73b7 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -35,7 +35,7 @@ jobs: arguments: build - name: Upload Artifacts if: steps.build.outcome == 'success' && matrix.java == '11' - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: grails-gsp.jar path: build/libs/grails-gsp-*.jar From a57d2da435739934bb691aa13832d9b9675cd855 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 15 Dec 2023 23:49:40 +0530 Subject: [PATCH 14/43] Update grails-testing-support monorepo to v3.1.1 (#398) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index e1b08233d3..16ba29df20 100644 --- a/gradle.properties +++ b/gradle.properties @@ -23,7 +23,7 @@ antVersion=1.10.14 controllersRef=https://docs.grails.org/latest/ref/Controllers commandLineRef=https://docs.grails.org/latest/ref/Command%20Line grailsDocsVersion=5.0.2 -testingSupportVersion=3.1.0 +testingSupportVersion=3.1.1 sitemeshVersion=2.4.4 junit-jupiter.version=5.8.0 From 8d45ef0618f301456477c8da6a1239d5c8e809b2 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 15 Dec 2023 23:49:50 +0530 Subject: [PATCH 15/43] Update dependency org.grails:grails-gradle-plugin to v6.1.1 (#400) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 16ba29df20..c1252b3cfc 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,7 +6,7 @@ projectUrl=https://github.com/grails/grails-gsp githubSlug=grails/grails-gsp githubBranch=6.1.x developers=Puneet Behl, Graeme Rocher -grailsGradlePluginVersion=6.1.0 +grailsGradlePluginVersion=6.1.1 grailsVersion=6.1.1 groovyVersion=3.0.11 servletApiVersion=4.0.1 From ce92d7da7bd10d2c26e9ebdf5f7707a43a7f6c41 Mon Sep 17 00:00:00 2001 From: Mattias Reichel Date: Thu, 21 Dec 2023 14:13:42 +0100 Subject: [PATCH 16/43] docs: Update documentation (#405) - Fix many broken links - Set correct code block syntax - Add locale param to select, timeZoneSelect, localeSelect and datePicker tags --- build.gradle | 11 ++++ src/main/docs/guide/GSPBasics.adoc | 8 +-- .../docs/guide/GSPBasics/expressions.adoc | 2 +- .../guide/GSPBasics/logicAndIteration.adoc | 4 +- .../docs/guide/GSPBasics/pageDirectives.adoc | 6 +-- .../guide/GSPBasics/variablesAndScopes.adoc | 22 ++++---- src/main/docs/guide/introduction.adoc | 18 +++---- src/main/docs/guide/layouts.adoc | 51 ++++++++++--------- .../makingChangesToADeployedApplication.adoc | 31 ++++++----- src/main/docs/guide/resources.adoc | 12 ++--- .../docs/guide/sitemeshContentBlocks.adoc | 2 +- src/main/docs/guide/taglibs.adoc | 12 ++--- .../docs/guide/taglibs/iterativeTags.adoc | 8 +-- src/main/docs/guide/taglibs/logicalTags.adoc | 2 +- src/main/docs/guide/taglibs/namespaces.adoc | 6 +-- src/main/docs/guide/taglibs/simpleTags.adoc | 8 +-- .../docs/guide/taglibs/tagReturnValue.adoc | 6 +-- .../taglibs/taglibVariablesAndScopes.adoc | 16 +++--- .../guide/taglibs/usingJSPTagLibraries.adoc | 21 +++++--- src/main/docs/guide/tags.adoc | 2 +- src/main/docs/guide/tags/formsAndFields.adoc | 20 ++++---- .../docs/guide/tags/linksAndResources.adoc | 4 +- .../docs/guide/tags/searchAndFiltering.adoc | 6 +-- .../docs/guide/tags/tagLogicAndIteration.adoc | 8 +-- .../guide/tags/tagVariablesAndScopes.adoc | 4 +- .../docs/guide/tags/tagsAsMethodCalls.adoc | 21 ++++---- src/main/docs/guide/viewsAndTemplates.adoc | 10 ++-- src/main/docs/ref/Tag Libraries.adoc | 5 +- .../docs/ref/Tag Libraries/actionName.adoc | 2 +- src/main/docs/ref/Tag Libraries/flash.adoc | 2 +- .../docs/ref/Tag Libraries/pageScope.adoc | 4 +- src/main/docs/ref/Tag Libraries/params.adoc | 10 ++-- src/main/docs/ref/Tag Libraries/request.adoc | 6 +-- src/main/docs/ref/Tag Libraries/response.adoc | 6 +-- .../ref/Tag Libraries/servletContext.adoc | 6 +-- src/main/docs/ref/Tag Libraries/session.adoc | 6 +-- src/main/docs/ref/Tags/actionSubmit.adoc | 4 +- src/main/docs/ref/Tags/actionSubmitImage.adoc | 2 +- src/main/docs/ref/Tags/applyLayout.adoc | 4 +- src/main/docs/ref/Tags/collect.adoc | 2 +- src/main/docs/ref/Tags/cookie.adoc | 2 +- src/main/docs/ref/Tags/country.adoc | 4 +- src/main/docs/ref/Tags/countrySelect.adoc | 22 ++++---- src/main/docs/ref/Tags/createLink.adoc | 28 +++++----- src/main/docs/ref/Tags/createLinkTo.adoc | 14 ++--- src/main/docs/ref/Tags/currencySelect.adoc | 4 +- src/main/docs/ref/Tags/datePicker.adoc | 8 +-- src/main/docs/ref/Tags/each.adoc | 2 +- src/main/docs/ref/Tags/eachError.adoc | 4 +- src/main/docs/ref/Tags/else.adoc | 2 +- src/main/docs/ref/Tags/elseif.adoc | 2 +- src/main/docs/ref/Tags/external.adoc | 6 +-- src/main/docs/ref/Tags/field.adoc | 4 +- src/main/docs/ref/Tags/fieldError.adoc | 4 +- src/main/docs/ref/Tags/fieldValue.adoc | 6 +-- src/main/docs/ref/Tags/findAll.adoc | 2 +- src/main/docs/ref/Tags/form.adoc | 10 ++-- src/main/docs/ref/Tags/formatBoolean.adoc | 2 +- src/main/docs/ref/Tags/formatDate.adoc | 8 +-- src/main/docs/ref/Tags/formatNumber.adoc | 12 ++--- src/main/docs/ref/Tags/grep.adoc | 2 +- src/main/docs/ref/Tags/hasErrors.adoc | 11 ++-- src/main/docs/ref/Tags/header.adoc | 4 +- src/main/docs/ref/Tags/hiddenField.adoc | 2 +- src/main/docs/ref/Tags/if.adoc | 2 +- src/main/docs/ref/Tags/img.adoc | 6 +-- src/main/docs/ref/Tags/include.adoc | 10 ++-- src/main/docs/ref/Tags/isAvailable.adoc | 4 +- src/main/docs/ref/Tags/isNotAvailable.adoc | 4 +- src/main/docs/ref/Tags/javascript.adoc | 6 +-- src/main/docs/ref/Tags/join.adoc | 3 +- src/main/docs/ref/Tags/layoutBody.adoc | 14 ++--- src/main/docs/ref/Tags/layoutHead.adoc | 15 +++--- src/main/docs/ref/Tags/layoutTitle.adoc | 14 ++--- src/main/docs/ref/Tags/link.adoc | 14 ++--- src/main/docs/ref/Tags/localeSelect.adoc | 7 +-- src/main/docs/ref/Tags/message.adoc | 8 +-- src/main/docs/ref/Tags/meta.adoc | 2 +- src/main/docs/ref/Tags/pageProperty.adoc | 20 ++++---- src/main/docs/ref/Tags/paginate.adoc | 6 +-- src/main/docs/ref/Tags/passwordField.adoc | 2 +- src/main/docs/ref/Tags/radio.adoc | 4 +- src/main/docs/ref/Tags/radioGroup.adoc | 6 +-- src/main/docs/ref/Tags/render.adoc | 14 ++--- src/main/docs/ref/Tags/resource.adoc | 14 ++--- src/main/docs/ref/Tags/select.adoc | 47 +++++++++-------- src/main/docs/ref/Tags/set.adoc | 10 ++-- src/main/docs/ref/Tags/sortableColumn.adoc | 4 +- src/main/docs/ref/Tags/textArea.adoc | 4 +- src/main/docs/ref/Tags/textField.adoc | 2 +- src/main/docs/ref/Tags/timeZoneSelect.adoc | 8 +-- src/main/docs/ref/Tags/unless.adoc | 4 +- src/main/docs/ref/Tags/uploadForm.adoc | 2 +- src/main/docs/ref/Tags/while.adoc | 2 +- 94 files changed, 413 insertions(+), 390 deletions(-) diff --git a/build.gradle b/build.gradle index 6e92c31680..0a72592f2d 100644 --- a/build.gradle +++ b/build.gradle @@ -99,6 +99,17 @@ subprojects { apply from: "${commonBuild}/common-docs.gradle" apply from: "${commonBuild}/common-publishing.gradle" +tasks.named('publishGuide') { + // Override value defined in grails/grails-common-build/common-docs.gradle + it.properties['commandLineRef'] = "https://docs.grails.org/$grailsVersion/ref/Command%20Line" + it.properties['controllersRef'] = "https://docs.grails.org/$grailsVersion/ref/Controllers" + it.properties['grailsapi'] = "https://docs.grails.org/$grailsVersion/api/" + it.properties['grailsdocs'] = "https://docs.grails.org/$grailsVersion/" + it.properties['groovyapi'] = "https://docs.groovy-lang.org/$groovyVersion/html/gapi/" + it.properties['groovyjdk'] = "https://docs.groovy-lang.org/$groovyVersion/html/groovy-jdk/" + it.properties['javase'] = 'https://docs.oracle.com/en/java/javase/11/docs/api/' +} + boolean isNonStable(String version) { version ==~ /(?i).+(-|\.?)(b|M|RC|Dev)\d?.*/ || ['alpha', 'beta', 'milestone', 'rc', 'cr', 'm', 'preview', 'b', 'ea'].any { qualifier -> diff --git a/src/main/docs/guide/GSPBasics.adoc b/src/main/docs/guide/GSPBasics.adoc index 412f189b1f..cc6f4ef925 100644 --- a/src/main/docs/guide/GSPBasics.adoc +++ b/src/main/docs/guide/GSPBasics.adoc @@ -2,7 +2,7 @@ In the next view sections we'll go through the basics of GSP and what is availab GSP supports the usage of `<% %>` scriptlet blocks to embed Groovy code (again this is discouraged): -[source,xml] +[,xml] ---- @@ -13,7 +13,7 @@ GSP supports the usage of `<% %>` scriptlet blocks to embed Groovy code (again t You can also use the `<%= %>` syntax to output values: -[source,xml] +[,xml] ---- @@ -24,7 +24,7 @@ You can also use the `<%= %>` syntax to output values: GSP also supports JSP-style server-side comments (which are not rendered in the HTML response) as the following example demonstrates: -[source,xml] +[,xml] ---- @@ -34,4 +34,4 @@ GSP also supports JSP-style server-side comments (which are not rendered in the ---- -WARNING: Embedding data received from user input has the risk of making your application vulnerable to an Cross Site Scripting (XSS) attack. Please read the documentation on link:security.html#xssPrevention[XSS prevention] for information on how to prevent XSS attacks. +WARNING: Embedding data received from user input has the risk of making your application vulnerable to an Cross Site Scripting (XSS) attack. Please read the documentation on {grailsdocs}guide/security.html#xssPrevention[XSS prevention] for information on how to prevent XSS attacks. diff --git a/src/main/docs/guide/GSPBasics/expressions.adoc b/src/main/docs/guide/GSPBasics/expressions.adoc index 10f9f996ea..1c4be6d13f 100644 --- a/src/main/docs/guide/GSPBasics/expressions.adoc +++ b/src/main/docs/guide/GSPBasics/expressions.adoc @@ -11,4 +11,4 @@ In GSP the `<%= %>` syntax introduced earlier is rarely used due to the support However, unlike JSP EL you can have any Groovy expression within the `${..}` block. -WARNING: Embedding data received from user input has the risk of making your application vulnerable to an Cross Site Scripting (XSS) attack. Please read the documentation on link:security.html#xssPrevention[XSS prevention] for information on how to prevent XSS attacks. +WARNING: Embedding data received from user input has the risk of making your application vulnerable to a Cross Site Scripting (XSS) attack. Please read the documentation on {grailsdocs}guide/security.html#xssPrevention[XSS prevention] for information on how to prevent XSS attacks. diff --git a/src/main/docs/guide/GSPBasics/logicAndIteration.adoc b/src/main/docs/guide/GSPBasics/logicAndIteration.adoc index aa204d97ac..a31867462b 100644 --- a/src/main/docs/guide/GSPBasics/logicAndIteration.adoc +++ b/src/main/docs/guide/GSPBasics/logicAndIteration.adoc @@ -1,6 +1,6 @@ Using the `<% %>` syntax you can embed loops and so on using this syntax: -[source,xml] +[,xml] ---- @@ -13,7 +13,7 @@ Using the `<% %>` syntax you can embed loops and so on using this syntax: As well as logical branching: -[source,xml] +[,xml] ---- diff --git a/src/main/docs/guide/GSPBasics/pageDirectives.adoc b/src/main/docs/guide/GSPBasics/pageDirectives.adoc index d2a8fd5fe0..0a5b457f4d 100644 --- a/src/main/docs/guide/GSPBasics/pageDirectives.adoc +++ b/src/main/docs/guide/GSPBasics/pageDirectives.adoc @@ -1,15 +1,15 @@ GSP also supports a few JSP-style page directives. -The import directive lets you import classes into the page. However, it is rarely needed due to Groovy's default imports and <>: +The import directive lets you import classes into the page. However, it is rarely needed due to Groovy's default imports and xref:tags.adoc[GSP Tags]: -[source,xml] +[,xml] ---- <%@ page import="java.awt.*" %> ---- GSP also supports the contentType directive: -[source,xml] +[,xml] ---- <%@ page contentType="application/json" %> ---- diff --git a/src/main/docs/guide/GSPBasics/variablesAndScopes.adoc b/src/main/docs/guide/GSPBasics/variablesAndScopes.adoc index b4ebbbb739..ec7618dea6 100644 --- a/src/main/docs/guide/GSPBasics/variablesAndScopes.adoc +++ b/src/main/docs/guide/GSPBasics/variablesAndScopes.adoc @@ -1,26 +1,26 @@ Within the `<% %>` brackets you can declare variables: -[source,xml] +[,] ---- <% now = new Date() %> ---- and then access those variables later in the page: -[source,xml] +[,] ---- <%=now%> ---- Within the scope of a GSP there are a number of pre-defined variables, including: -* `application` - The http://docs.oracle.com/javaee/1.4/api/javax/servlet/ServletContext.html[javax.servlet.ServletContext] instance -* `applicationContext` The Spring http://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/context/ApplicationContext.html[ApplicationContext] instance -* `flash` - The link:{controllersRef}/flash.html[flash] object -* `grailsApplication` - The http://docs.grails.org/latest/api/grails/core/GrailsApplication.html[GrailsApplication] instance +* `application` - The {javaee}javax/servlet/ServletContext.html[javax.servlet.ServletContext] instance +* `applicationContext` The Spring {springapi}org/springframework/context/ApplicationContext.html[ApplicationContext] instance +* `flash` - The {controllersRef}/flash.html[flash] object +* `grailsApplication` - The {grailsapi}grails/core/GrailsApplication.html[GrailsApplication] instance * `out` - The response writer for writing to the output stream -* `params` - The link:{controllersRef}/params.html[params] object for retrieving request parameters -* `request` - The http://docs.oracle.com/javaee/1.4/api/javax/servlet/http/HttpServletRequest.html[HttpServletRequest] instance -* `response` - The http://docs.oracle.com/javaee/1.4/api/javax/servlet/http/HttpServletResponse.html[HttpServletResponse] instance -* `session` - The http://docs.oracle.com/javaee/1.4/api/javax/servlet/http/HttpSession.html[HttpSession] instance -* `webRequest` - The http://docs.grails.org/latest/api/org/grails/web/servlet/mvc/GrailsWebRequest.html[GrailsWebRequest] instance +* `params` - The {controllersRef}/params.html[params] object for retrieving request parameters +* `request` - The {javaee}javax/servlet/http/HttpServletRequest.html[HttpServletRequest] instance +* `response` - The {javaee}javax/servlet/http/HttpServletResponse.html[HttpServletResponse] instance +* `session` - The {javaee}javax/servlet/http/HttpSession.html[HttpSession] instance +* `webRequest` - The {grailsapi}org/grails/web/servlet/mvc/GrailsWebRequest.html[GrailsWebRequest] instance diff --git a/src/main/docs/guide/introduction.adoc b/src/main/docs/guide/introduction.adoc index 8173205620..6663526137 100644 --- a/src/main/docs/guide/introduction.adoc +++ b/src/main/docs/guide/introduction.adoc @@ -6,22 +6,22 @@ GSP was previously part of Grails core, but since version 3.3 it is an independe .build.gradle ---- dependencies { - ... + //... implementation "org.grails.plugins:gsp:{version}" } ---- -In addition for production compilation you should apply the `grails-gsp` Gradle plugin: +In addition, for production compilation you should apply the `grails-gsp` Gradle plugin: -[source,groovy,subs="attributes"] +[source,groovy] .build.gradle ---- -apply plugin:"org.grails.grails-gsp" +apply plugin: "org.grails.grails-gsp" ---- -GSPs themselves live in the `grails-app/views` directory and are typically rendered automatically (by convention) or with the link:{controllersRef}/render.html[render] method such as: +GSPs themselves live in the `grails-app/views` directory and are typically rendered automatically (by convention) or with the {controllersRef}/render.html[render] method such as: -[source,java] +[source,groovy] ---- render(view: "index") ---- @@ -32,7 +32,7 @@ NOTE: Although it is possible to have Groovy logic embedded in your GSP and doin A GSP typically has a "model" which is a set of variables that are used for view rendering. The model is passed to the GSP view from a controller. For example consider the following controller action: -[source,java] +[source,groovy] ---- def show() { [book: Book.get(params.id)] @@ -41,9 +41,9 @@ def show() { This action will look up a `Book` instance and create a model that contains a key called `book`. This key can then be referenced within the GSP view using the name `book`: -[source,groovy] +[source,gsp] ---- ${book.title} ---- -WARNING: Embedding data received from user input has the risk of making your application vulnerable to an Cross Site Scripting (XSS) attack. Please read the documentation on link:https://docs.grails.org/latest/guide/security.html#xssPrevention[XSS prevention] for information on how to prevent XSS attacks. +WARNING: Embedding data received from user input has the risk of making your application vulnerable to a Cross Site Scripting (XSS) attack. Please read the documentation on {grailsdocs}guide/security.html#xssPrevention[XSS prevention] for information on how to prevent XSS attacks. diff --git a/src/main/docs/guide/layouts.adoc b/src/main/docs/guide/layouts.adoc index be2691fdea..4cbba03f8f 100644 --- a/src/main/docs/guide/layouts.adoc +++ b/src/main/docs/guide/layouts.adoc @@ -2,7 +2,7 @@ ==== Creating Layouts -Grails leverages http://sitemesh.org[Sitemesh], a decorator engine, to support view layouts. Layouts are located in the `grails-app/views/layouts` directory. A typical layout can be seen below: +Grails leverages https://github.com/sitemesh[Sitemesh], a decorator engine, to support view layouts. Layouts are located in the `grails-app/views/layouts` directory. A typical layout can be seen below: [source,xml] ---- @@ -20,13 +20,13 @@ Grails leverages http://sitemesh.org[Sitemesh], a decorator engine, to support v ---- -The key elements are the link:../ref/Tags/layoutHead.html[layoutHead], link:../ref/Tags/layoutTitle.html[layoutTitle] and link:../ref/Tags/layoutBody.html[layoutBody] tag invocations: +The key elements are the xref:../ref/Tags/layoutHead.adoc[layoutHead], xref:../ref/Tags/layoutTitle.adoc[layoutTitle] and xref:../ref/Tags/layoutBody.adoc[layoutBody] tag invocations: * `layoutTitle` - outputs the target page's title * `layoutHead` - outputs the target page's head tag contents * `layoutBody` - outputs the target page's body tag contents -The previous example also demonstrates the link:../ref/Tags/pageProperty.html[pageProperty] tag which can be used to inspect and return aspects of the target page. +The previous example also demonstrates the xref:../ref/Tags/pageProperty.adoc[pageProperty] tag which can be used to inspect and return aspects of the target page. ==== Triggering Layouts @@ -45,7 +45,7 @@ There are a few ways to trigger a layout. The simplest is to add a meta tag to t ---- -In this case a layout called `grails-app/views/layouts/main.gsp` will be used to layout the page. If we were to use the layout from the previous section the output would resemble this: +In this case a layout called `grails-app/views/layouts/main.gsp` will be used to lay out the page. If we were to use the layout from the previous section the output would resemble this: [source,xml] ---- @@ -68,23 +68,23 @@ In this case a layout called `grails-app/views/layouts/main.gsp` will be used to Another way to specify a layout is to specify the name of the layout by assigning a value to the "layout" property in a controller. For example, if you have a controller such as: -[source,java] +[source,groovy] ---- class BookController { static layout = 'customer' - def list() { ... } + def list() { /*...*/ } } ---- -You can create a layout called `grails-app/views/layouts/customer.gsp` which will be applied to all views that the `BookController` delegates to. The value of the "layout" property may contain a directory structure relative to the `grails-app/views/layouts/` directory. For example: +You can create a layout called `grails-app/views/layouts/customer.gsp` which will be applied to all views that the `BookController` delegates to. The value of the `layout` property may contain a directory structure relative to the `grails-app/views/layouts/` directory. For example: -[source,java] +[source,groovy] ---- class BookController { static layout = 'custom/customer' - def list() { ... } + def list() { /*...*/ } } ---- @@ -96,10 +96,10 @@ Views rendered from that controller would be decorated with the `grails-app/view Another way to associate layouts is to use "layout by convention". For example, if you have this controller: -[source,java] +[source,groovy] ---- class BookController { - def list() { ... } + def list() { /*...*/ } } ---- @@ -107,15 +107,16 @@ You can create a layout called `grails-app/views/layouts/book.gsp`, which will b Alternatively, you can create a layout called `grails-app/views/layouts/book/list.gsp` which will only be applied to the `list` action within the `BookController`. -If you have both the above mentioned layouts in place the layout specific to the action will take precedence when the list action is executed. +If you have both the above-mentioned layouts in place the layout specific to the action will take precedence when the list action is executed. -If a layout may not be located using any of those conventions, the convention of last resort is to look for the application default layout which -is `grails-app/views/layouts/application.gsp`. The name of the application default layout may be changed by defining a property -in `grails-app/conf/application.groovy` as follows: +If a layout is not located using any of those conventions, the convention of last resort is to look for the application default layout which +is `grails-app/views/layouts/application.gsp`. The name of the application default layout may be changed by defining the property `grails.sitemesh.default.layout` +in the application configuration as follows: -[source,java] +[source,yaml] +.grails-app/conf/application.yml ---- -grails.sitemesh.default.layout = 'myLayoutName' +grails.sitemesh.default.layout: myLayoutName ---- With that property in place, the application default layout will be `grails-app/views/layouts/myLayoutName.gsp`. @@ -124,15 +125,15 @@ With that property in place, the application default layout will be `grails-app/ ==== Inline Layouts -Grails' also supports Sitemesh's concept of inline layouts with the link:../ref/Tags/applyLayout.html[applyLayout] tag. This can be used to apply a layout to a template, URL or arbitrary section of content. This lets you even further modularize your view structure by "decorating" your template includes. +Grails' also supports Sitemesh's concept of inline layouts with the xref:../ref/Tags/applyLayout.adoc[applyLayout] tag. This can be used to apply a layout to a template, URL or arbitrary section of content. This lets you even further modularize your view structure by "decorating" your template includes. Some examples of usage can be seen below: -[source,xml] +[,xml] ---- - + The content to apply a layout to @@ -143,14 +144,14 @@ The content to apply a layout to ==== Server-Side Includes -While the link:../ref/Tags/applyLayout.html[applyLayout] tag is useful for applying layouts to external content, if you simply want to include external content in the current page you use the link:../ref/Tags/include.html[include] tag: +While the xref:../ref/Tags/applyLayout.adoc[applyLayout] tag is useful for applying layouts to external content, if you simply want to include external content in the current page you use the xref:../ref/Tags/include.adoc[include] tag: [source,xml] ---- ---- -You can even combine the link:../ref/Tags/include.html[include] tag and the link:../ref/Tags/applyLayout.html[applyLayout] tag for added flexibility: +You can even combine the xref:../ref/Tags/include.adoc[include] tag and the xref:../ref/Tags/applyLayout.adoc[applyLayout] tag for added flexibility: [source,xml] ---- @@ -159,11 +160,11 @@ You can even combine the link:../ref/Tags/include.html[include] tag and the link ---- -Finally, you can also call the link:../ref/Tags/include.html[include] tag from a controller or tag library as a method: +Finally, you can also call the xref:../ref/Tags/include.adoc[include] tag from a controller or tag library as a method: -[source,java] +[source,groovy] ---- def content = include(controller:"book", action:"list") ---- -The resulting content will be provided via the return value of the link:../ref/Tags/include.html[include] tag. +The resulting content will be provided via the return value of the xref:../ref/Tags/include.adoc[include] tag. diff --git a/src/main/docs/guide/makingChangesToADeployedApplication.adoc b/src/main/docs/guide/makingChangesToADeployedApplication.adoc index 90e4ba5cf4..bf27763169 100644 --- a/src/main/docs/guide/makingChangesToADeployedApplication.adoc +++ b/src/main/docs/guide/makingChangesToADeployedApplication.adoc @@ -1,19 +1,19 @@ -One of the main issues with deploying a Grails application (or typically any servlet-based one) is that any change to the views requires that you redeploy your whole application. If all you want to do is fix a typo on a page, or change an image link, it can seem like a lot of unnecessary work. For such simple requirements, Grails does have a solution: the `grails.gsp.view.dir` configuration setting. +One of the main issues with deploying a Grails application (or typically any servlet-based application) is that any change to the views requires that you redeploy your whole application. If all you want to do is fix a typo on a page, or change an image link, it can seem like a lot of unnecessary work. For such simple requirements, Grails does have a solution: the `grails.gsp.view.dir` configuration setting. -How does this work? The first step is to decide where the GSP files should go. Let's say we want to keep them unpacked in a `/var/www/grails/my-app` directory. We add these two lines to `grails-app/conf/application.groovy` : -[source,groovy] +How does this work? The first step is to decide where the GSP files should go. Let's say we want to keep them unpacked in a `/var/www/grails/my-app` directory. We add these two properties to the application configuration: +[source,yaml] +.grails-app/conf/application.yml ---- -grails.gsp.enable.reload = true -grails.gsp.view.dir = "/var/www/grails/my-app/" +grails.gsp.enable.reload: true +grails.gsp.view.dir: /var/www/grails/my-app/ ---- -The first line tells Grails that modified GSP files should be reloaded at runtime. If you don't have this setting, you can make as many changes as you like but they won't be reflected in the running application until you restart. The second line tells Grails where to load the views and layouts from. +The first line tells Grails that modified GSP files should be reloaded at runtime. If you don't have this setting, you can make as many changes as you like, but they won't be reflected in the running application until you restart. The second line tells Grails where to load the views and layouts from. NOTE: The trailing slash on the `grails.gsp.view.dir` value is important! Without it, Grails will look for views in the parent directory. -Setting "grails.gsp.view.dir" is optional. If it's not specified, you can update files directly to the application server's deployed war directory. Depending on the application server, these files might get overwritten when the server is restarted. Most application servers support "exploded war deployment" which is recommended in this case. +Setting `grails.gsp.view.dir` is optional. If it's not specified, you can update files directly to the application server's deployed war directory. Depending on the application server, these files might get overwritten when the server is restarted. Most application servers support "exploded war deployment" which is recommended in this case. With those settings in place, all you need to do is copy the views from your web application to the external directory. On a Unix-like system, this would look something like this: -[source,groovy] ---- mkdir -p /var/www/grails/my-app/grails-app/views cp -R grails-app/views/* /var/www/grails/my-app/grails-app/views @@ -22,14 +22,13 @@ The key point here is that you must retain the view directory structure, includi One thing to bear in mind with this technique is that every time you modify a GSP, it uses up permgen space. So at some point you will eventually hit "out of permgen space" errors unless you restart the server. So this technique is not recommended for frequent or large changes to the views. -There are also some System properties to control GSP reloading: -[format="csv", options="header"] +There are also some system properties to control GSP reloading: +[cols=3, options="header"] |=== - -*Name*,*Description*,*Default* -grails.gsp.enable.reload,alternative system property for enabling the GSP reload mode without changing `application.groovy` -grails.gsp.reload.interval,interval between checking the lastmodified time of the gsp source file, unit is milliseconds,5000 -grails.gsp.reload.granularity,the number of milliseconds leeway to give before deciding a file is out of date. this is needed because different roundings usually cause a 1000ms difference in lastmodified times,1000 +|Name|Description|Default +|grails.gsp.enable.reload|system property for enabling the GSP reload mode (alternative to adding it in the file-based application configuration| +|grails.gsp.reload.interval|interval between checking the lastmodified time of the gsp source file, unit is milliseconds|5000 +|grails.gsp.reload.granularity|the number of milliseconds leeway to give before deciding a file is out of date. this is needed because different roundings usually cause a 1000ms difference in lastmodified times|1000 |=== -GSP reloading is supported for precompiled GSPs since Grails 1.3.5 . +GSP reloading is supported for precompiled GSPs since Grails 1.3.5. diff --git a/src/main/docs/guide/resources.adoc b/src/main/docs/guide/resources.adoc index 9ffd7694b4..eaeb109a3b 100644 --- a/src/main/docs/guide/resources.adoc +++ b/src/main/docs/guide/resources.adoc @@ -1,21 +1,21 @@ -Grails 3 integrates with the http://grails.org/plugin/asset-pipeline[Asset Pipeline plugin] to provide sophisticated static asset management. This plugin is installed by default in new Grails applications. +Since version 3, Grails integrates with the https://github.com/bertramdev/asset-pipeline[Asset Pipeline plugin] to provide sophisticated static asset management. This plugin is installed by default in new Grails applications. -The basic way to include a link to a static asset in your application is to use the link:../ref/Tags/resource.html[resource] tag. This simple approach creates a URI pointing to the file. +The basic way to include a link to a static asset in your application is to use the xref:../ref/Tags/resource.adoc[resource] tag. This simple approach creates a URI pointing to the file. -However modern applications with dependencies on multiple JavaScript and CSS libraries and frameworks (as well as dependencies on multiple Grails plugins) require something more powerful. +However, modern applications with dependencies on multiple JavaScript and CSS libraries and frameworks (as well as dependencies on multiple Grails plugins) require something more powerful. The issues that the Asset-Pipeline plugin tackles are: * Reduced Dependence - The plugin has compression, minification, and cache-digests built in. * Easy Debugging - Makes for easy debugging by keeping files separate in development mode. -* Asset Bundling using require http://bertramdev.github.io/asset-pipeline/guide/usage.html#directives[directives]. +* Asset Bundling using require http://asset-pipeline.com/manual/index.html#directives[directives]. * Web application performance tuning is difficult. * The need for a standard way to expose static assets in plugins and applications. * The need for extensible processing to make languages like LESS or Coffee first class citizens. -The asset-pipeline allows you to define your javascript or css requirements right at the top of the file and they get compiled on War creation. +The asset-pipeline allows you to define your javascript or css requirements right at the top of the file, and they get compiled on War creation. -Take a look at the http://bertramdev.github.io/asset-pipeline[documentation] for the asset-pipeline to get started. +Take a look at the http://asset-pipeline.com/manual[documentation] for the asset-pipeline to get started. If you do not want to use the Asset-Pipeline plugin, you can serve the static assets from directories `src/main/resources/public` or `src/main/webapp`, but the latter one only gets included in WAR packaging but not in JAR packaging. diff --git a/src/main/docs/guide/sitemeshContentBlocks.adoc b/src/main/docs/guide/sitemeshContentBlocks.adoc index 30c971c595..56816fb3be 100644 --- a/src/main/docs/guide/sitemeshContentBlocks.adoc +++ b/src/main/docs/guide/sitemeshContentBlocks.adoc @@ -1,6 +1,6 @@ Although it is useful to decorate an entire page sometimes you may find the need to decorate independent sections of your site. To do this you can use content blocks. To get started, partition the page to be decorated using the `` tag: -[source,xml] +[,xml] ---- ... draw the navbar here... diff --git a/src/main/docs/guide/taglibs.adoc b/src/main/docs/guide/taglibs.adoc index d1db903dfa..2d1262e39d 100644 --- a/src/main/docs/guide/taglibs.adoc +++ b/src/main/docs/guide/taglibs.adoc @@ -1,8 +1,8 @@ -Like http://www.oracle.com/technetwork/java/javaee/jsp/index.html[Java Server Pages] (JSP), GSP supports the concept of custom tag libraries. Unlike JSP, Grails' tag library mechanism is simple, elegant and completely reloadable at runtime. +Like https://www.oracle.com/java/technologies/jspt.html[Java Server Pages] (JSP), GSP supports the concept of custom tag libraries. Unlike JSP, Grails' tag library mechanism is simple, elegant and completely reloadable at runtime. Quite simply, to create a tag library create a Groovy class that ends with the convention `TagLib` and place it within the `grails-app/taglib` directory: -[source,java] +[source,groovy] ---- class SimpleTagLib { @@ -11,7 +11,7 @@ class SimpleTagLib { Now to create a tag create a Closure property that takes two arguments: the tag attributes and the body content: -[source,java] +[source,groovy] ---- class SimpleTagLib { def simple = { attrs, body -> @@ -22,7 +22,7 @@ class SimpleTagLib { The `attrs` argument is a Map of the attributes of the tag, whilst the `body` argument is a Closure that returns the body content when invoked: -[source,java] +[source,groovy] ---- class SimpleTagLib { def emoticon = { attrs, body -> @@ -42,7 +42,7 @@ NOTE: To help IDEs like Spring Tool Suite (STS) and others autocomplete tag attr For example: -[source,java] +[source,groovy] ---- class SimpleTagLib { @@ -60,7 +60,7 @@ class SimpleTagLib { and any mandatory attributes should include the REQUIRED keyword, e.g. -[source,java] +[source,groovy] ---- class SimpleTagLib { diff --git a/src/main/docs/guide/taglibs/iterativeTags.adoc b/src/main/docs/guide/taglibs/iterativeTags.adoc index 74999aef03..df0c69b3de 100644 --- a/src/main/docs/guide/taglibs/iterativeTags.adoc +++ b/src/main/docs/guide/taglibs/iterativeTags.adoc @@ -1,6 +1,6 @@ Iterative tags are easy too, since you can invoke the body multiple times: -[source,java] +[source,groovy] ---- def repeat = { attrs, body -> attrs.times?.toInteger()?.times { num -> @@ -20,14 +20,14 @@ In this example we check for a `times` attribute and if it exists convert it to Notice how in this example we use the implicit `it` variable to refer to the current number. This works because when we invoked the body we passed in the current value inside the iteration: -[source,java] +[source,groovy] ---- out << body(num) ---- That value is then passed as the default variable `it` to the tag. However, if you have nested tags this can lead to conflicts, so you should instead name the variables that the body uses: -[source,java] +[source,groovy] ---- def repeat = { attrs, body -> def var = attrs.var ?: "num" @@ -39,7 +39,7 @@ def repeat = { attrs, body -> Here we check if there is a `var` attribute and if there is use that as the name to pass into the body invocation on this line: -[source,java] +[source,groovy] ---- out << body((var):num) ---- diff --git a/src/main/docs/guide/taglibs/logicalTags.adoc b/src/main/docs/guide/taglibs/logicalTags.adoc index e335931daa..420dad0f5b 100644 --- a/src/main/docs/guide/taglibs/logicalTags.adoc +++ b/src/main/docs/guide/taglibs/logicalTags.adoc @@ -1,6 +1,6 @@ You can also create logical tags where the body of the tag is only output once a set of conditions have been met. An example of this may be a set of security tags: -[source,java] +[source,groovy] ---- def isAdmin = { attrs, body -> def user = attrs.user diff --git a/src/main/docs/guide/taglibs/namespaces.adoc b/src/main/docs/guide/taglibs/namespaces.adoc index d09824f9d1..9733957597 100644 --- a/src/main/docs/guide/taglibs/namespaces.adoc +++ b/src/main/docs/guide/taglibs/namespaces.adoc @@ -1,12 +1,12 @@ By default, tags are added to the default Grails namespace and are used with the `g:` prefix in GSP pages. However, you can specify a different namespace by adding a static property to your `TagLib` class: -[source,java] +[source,groovy] ---- class SimpleTagLib { static namespace = "my" def example = { attrs -> - ... + //... } } ---- @@ -22,7 +22,7 @@ where the prefix is the same as the value of the static `namespace` property. Na Tags within namespaces can be invoked as methods using the namespace as a prefix to the method call: -[source,java] +[source,groovy] ---- out << my.example(name:"foo") ---- diff --git a/src/main/docs/guide/taglibs/simpleTags.adoc b/src/main/docs/guide/taglibs/simpleTags.adoc index 062215a664..27e835db3b 100644 --- a/src/main/docs/guide/taglibs/simpleTags.adoc +++ b/src/main/docs/guide/taglibs/simpleTags.adoc @@ -1,6 +1,6 @@ As demonstrated in the previous example it is easy to write simple tags that have no body and just output content. Another example is a `dateFormat` style tag: -[source,java] +[source,groovy] ---- def dateFormat = { attrs, body -> out << new java.text.SimpleDateFormat(attrs.format).format(attrs.date) @@ -16,7 +16,7 @@ The above uses Java's `SimpleDateFormat` class to format a date and then write i With simple tags sometimes you need to write HTML mark-up to the response. One approach would be to embed the content directly: -[source,java] +[source,groovy] ---- def formatBook = { attrs, body -> out << "
" @@ -25,9 +25,9 @@ def formatBook = { attrs, body -> } ---- -Although this approach may be tempting it is not very clean. A better approach would be to reuse the link:../ref/Tags/render.html[render] tag: +Although this approach may be tempting it is not very clean. A better approach would be to reuse the xref:../ref/Tags/render.adoc[render] tag: -[source,java] +[source,groovy] ---- def formatBook = { attrs, body -> out << render(template: "bookTemplate", model: [book: attrs.book]) diff --git a/src/main/docs/guide/taglibs/tagReturnValue.adoc b/src/main/docs/guide/taglibs/tagReturnValue.adoc index 5a2acef09b..9968f940a6 100644 --- a/src/main/docs/guide/taglibs/tagReturnValue.adoc +++ b/src/main/docs/guide/taglibs/tagReturnValue.adoc @@ -1,4 +1,4 @@ -A taglib can be used in a GSP as an ordinary tag or it might be used as a function in other taglibs or GSP expressions. +A taglib can be used in a GSP as an ordinary tag, or it might be used as a function in other taglibs or GSP expressions. Internally Grails intercepts calls to taglib closures. The "out" that is available in a taglib is mapped to a `java.io.Writer` implementation that writes to a buffer @@ -13,7 +13,7 @@ If the tag is not included in the returnObjectForTags array, then its return val Using "out" to write output in returnObjectForTags is not supported. Example: -[source,java] +[source,groovy] ---- class ObjectReturningTagLib { static namespace = "cms" @@ -25,6 +25,6 @@ class ObjectReturningTagLib { } ---- -Given this example cms.content(code:'something') call in another taglib or GSP expression would return the value "CmsContent.content" directly to the caller without +Given this example `cms.content(code: 'something')` call in another taglib or GSP expression would return the value `CmsContent.content` directly to the caller without wrapping the return value in a buffer. It might be worth doing so also because of performance optimization reasons. There is no need to wrap the tag return value in an output buffer in such cases. diff --git a/src/main/docs/guide/taglibs/taglibVariablesAndScopes.adoc b/src/main/docs/guide/taglibs/taglibVariablesAndScopes.adoc index 7a13cba5ac..1092f30ddf 100644 --- a/src/main/docs/guide/taglibs/taglibVariablesAndScopes.adoc +++ b/src/main/docs/guide/taglibs/taglibVariablesAndScopes.adoc @@ -2,13 +2,13 @@ Within the scope of a tag library there are a number of pre-defined variables in * `actionName` - The currently executing action name * `controllerName` - The currently executing controller name -* `flash` - The link:{controllersRef}/flash.html[flash] object -* `grailsApplication` - The http://docs.grails.org/latest/api/grails/core/GrailsApplication.html[GrailsApplication] instance +* `flash` - The {controllersRef}/flash.html[flash] object +* `grailsApplication` - The {grailsapi}grails/core/GrailsApplication.html[GrailsApplication] instance * `out` - The response writer for writing to the output stream -* `pageScope` - A reference to the https://gsp.grails.org/latest/ref/Tag%20Libraries/pageScope.html[pageScope] object used for GSP rendering (i.e. the binding) -* `params` - The link:{controllersRef}/params.html[params] object for retrieving request parameters +* `pageScope` - A reference to the xref:../ref/Tag%20Libraries/pageScope.adoc[pageScope] object used for GSP rendering (i.e. the binding) +* `params` - The {controllersRef}/params.html[params] object for retrieving request parameters * `pluginContextPath` - The context path to the plugin that contains the tag library -* `request` - The http://docs.oracle.com/javaee/1.4/api/javax/servlet/http/HttpServletRequest.html[HttpServletRequest] instance -* `response` - The http://docs.oracle.com/javaee/1.4/api/javax/servlet/http/HttpServletResponse.html[HttpServletResponse] instance -* `servletContext` - The http://docs.oracle.com/javaee/1.4/api/javax/servlet/ServletContext.html[javax.servlet.ServletContext] instance -* `session` - The http://docs.oracle.com/javaee/1.4/api/javax/servlet/http/HttpSession.html[HttpSession] instance +* `request` - The {javaee}javax/servlet/http/HttpServletRequest.html[HttpServletRequest] instance +* `response` - The {javaee}javax/servlet/http/HttpServletResponse.html[HttpServletResponse] instance +* `servletContext` - The {javaee}javax/servlet/ServletContext.html[javax.servlet.ServletContext] instance +* `session` - The {javaee}javax/servlet/http/HttpSession.html[HttpSession] instance diff --git a/src/main/docs/guide/taglibs/usingJSPTagLibraries.adoc b/src/main/docs/guide/taglibs/usingJSPTagLibraries.adoc index 831c82b8a2..cb90360962 100644 --- a/src/main/docs/guide/taglibs/usingJSPTagLibraries.adoc +++ b/src/main/docs/guide/taglibs/usingJSPTagLibraries.adoc @@ -6,15 +6,15 @@ In order to use JSP support you must ensure you have the `grails-web-jsp` depend .build.gradle ---- dependencies { - ... + //... runtimeOnly "org.grails:grails-web-jsp:{version}" } ---- -Then you will need to declare the JSP to use with the `taglib` directive at the top of your GSP file: +Then you will need to declare the JSP taglib to use with the `taglib` directive at the top of your GSP file: -[source,xml] +[,xml] ---- <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> ---- @@ -22,20 +22,25 @@ Then you will need to declare the JSP to use with the `taglib` directive at the Besides this you have to configure Grails to scan for the JSP tld files. This is configured with the `grails.gsp.tldScanPattern` setting. It accepts a comma separated String value. Spring's PathMatchingResourcePatternResolver is used to resolve the patterns. -For example you could scan for all available tld files by adding this to `application.yml`: +For example, you could scan for all available tld files by adding this to `application.yml`: [source,yaml] +.grails-app/conf/application.yml ---- grails: gsp: - tldScanPattern:'classpath*:/META-INF/*.tld,/WEB-INF/tld/*.tld' + tldScanPattern: 'classpath*:/META-INF/*.tld,/WEB-INF/tld/*.tld' ---- JSTL standard library is no longer added as a dependency by default. In case you are using JSTL, you should also add these dependencies to `build.gradle`: [source,groovy] +.build.gradle ---- - runtimeOnly 'javax.servlet:jstl:1.1.2' - runtimeOnly 'taglibs:standard:1.1.2' +dependencies { + //... + runtimeOnly 'javax.servlet:jstl:1.1.2' + runtimeOnly 'taglibs:standard:1.1.2' +} ---- Then you can use JSP tags like any other tag: @@ -47,7 +52,7 @@ Then you can use JSP tags like any other tag: With the added bonus that you can invoke JSP tags like methods: -[source,java] +[source,gsp] ---- ${fmt.formatNumber(value:10, pattern:".00")} ---- diff --git a/src/main/docs/guide/tags.adoc b/src/main/docs/guide/tags.adoc index 37fbf5517d..3960adfbc4 100644 --- a/src/main/docs/guide/tags.adoc +++ b/src/main/docs/guide/tags.adoc @@ -1,6 +1,6 @@ Now that the less attractive JSP heritage has been set aside, the following sections cover GSP's built-in tags, which are the preferred way to define GSP pages. -NOTE: The section on <> covers how to add your own custom tag libraries. +NOTE: The section on xref:taglibs.adoc[Tag Libraries] covers how to add your own custom tag libraries. All built-in GSP tags start with the prefix `g:`. Unlike JSP, you don't specify any tag library imports. If a tag starts with `g:` it is automatically assumed to be a GSP tag. An example GSP tag would look like: diff --git a/src/main/docs/guide/tags/formsAndFields.adoc b/src/main/docs/guide/tags/formsAndFields.adoc index f92862f492..55a47aa332 100644 --- a/src/main/docs/guide/tags/formsAndFields.adoc +++ b/src/main/docs/guide/tags/formsAndFields.adoc @@ -2,14 +2,14 @@ ==== Form Basics -GSP supports many different tags for working with HTML forms and fields, the most basic of which is the link:../ref/Tags/form.html[form] tag. This is a controller/action aware version of the regular HTML form tag. The `url` attribute lets you specify which controller and action to map to: +GSP supports many different tags for working with HTML forms and fields, the most basic of which is the xref:../ref/Tags/form.adoc[form] tag. This is a controller/action aware version of the regular HTML form tag. The `url` attribute lets you specify which controller and action to map to: [source,xml] ---- ... ---- -In this case we create a form called `myForm` that submits to the `BookController`'s `list` action. Beyond that all of the usual HTML attributes apply. +In this case we create a form called `myForm` that submits to the ``BookController``'s `list` action. Beyond that, all the usual HTML attributes apply. ==== Form Fields @@ -17,12 +17,12 @@ In this case we create a form called `myForm` that submits to the `BookControlle In addition to easy construction of forms, GSP supports custom tags for dealing with different types of fields, including: -* link:../ref/Tags/textField.html[textField] - For input fields of type 'text' -* link:../ref/Tags/passwordField.html[passwordField] - For input fields of type 'password' -* link:../ref/Tags/checkBox.html[checkBox] - For input fields of type 'checkbox' -* link:../ref/Tags/radio.html[radio] - For input fields of type 'radio' -* link:../ref/Tags/hiddenField.html[hiddenField] - For input fields of type 'hidden' -* link:../ref/Tags/select.html[select] - For dealing with HTML select boxes +* xref:../ref/Tags/textField.adoc[textField] - For input fields of type 'text' +* xref:../ref/Tags/passwordField.adoc[passwordField] - For input fields of type 'password' +* xref:../ref/Tags/checkBox.adoc[checkBox] - For input fields of type 'checkbox' +* xref:../ref/Tags/radio.adoc[radio] - For input fields of type 'radio' +* xref:../ref/Tags/hiddenField.adoc[hiddenField] - For input fields of type 'hidden' +* xref:../ref/Tags/select.adoc[select] - For dealing with HTML select boxes Each of these allows GSP expressions for the value: @@ -31,13 +31,13 @@ Each of these allows GSP expressions for the value: ---- -GSP also contains extended helper versions of the above tags such as link:../ref/Tags/radioGroup.html[radioGroup] (for creating groups of link:../ref/Tags/radio.html[radio] tags), link:../ref/Tags/localeSelect.html[localeSelect], link:../ref/Tags/currencySelect.html[currencySelect] and link:../ref/Tags/timeZoneSelect.html[timeZoneSelect] (for selecting locales, currencies and time zones respectively). +GSP also contains extended helper versions of the above tags such as xref:../ref/Tags/radioGroup.adoc[radioGroup] (for creating groups of xref:../ref/Tags/radio.adoc[radio] tags), xref:../ref/Tags/localeSelect.adoc[localeSelect], xref:../ref/Tags/currencySelect.adoc[currencySelect] and xref:../ref/Tags/timeZoneSelect.adoc[timeZoneSelect] (for selecting locales, currencies and time zones respectively). ==== Multiple Submit Buttons -The age old problem of dealing with multiple submit buttons is also handled elegantly with Grails using the link:../ref/Tags/actionSubmit.html[actionSubmit] tag. It is just like a regular submit, but lets you specify an alternative action to submit to: +The age-old problem of dealing with multiple submit buttons is also handled elegantly with Grails using the xref:../ref/Tags/actionSubmit.adoc[actionSubmit] tag. It is just like a regular submit, but lets you specify an alternative action to submit to: [source,xml] ---- diff --git a/src/main/docs/guide/tags/linksAndResources.adoc b/src/main/docs/guide/tags/linksAndResources.adoc index 558bc8eec5..94dc923645 100644 --- a/src/main/docs/guide/tags/linksAndResources.adoc +++ b/src/main/docs/guide/tags/linksAndResources.adoc @@ -1,6 +1,6 @@ -GSP also features tags to help you manage linking to controllers and actions. The link:../ref/Tags/link.html[link] tag lets you specify controller and action name pairing and it will automatically work out the link based on the <>, even if you change them! For example: +GSP also features tags to help you manage linking to controllers and actions. The xref:../ref/Tags/link.adoc[link] tag lets you specify controller and action name pairing and it will automatically work out the link based on the {grailsdocs}guide/theWebLayer#urlmappings[URL Mappings], even if you change them! For example: -[source,xml] +[,xml] ---- Book 1 diff --git a/src/main/docs/guide/tags/searchAndFiltering.adoc b/src/main/docs/guide/tags/searchAndFiltering.adoc index d8402bcfcf..1031b57f00 100644 --- a/src/main/docs/guide/tags/searchAndFiltering.adoc +++ b/src/main/docs/guide/tags/searchAndFiltering.adoc @@ -1,6 +1,6 @@ -If you have collections of objects you often need to sort and filter them. Use the link:../ref/Tags/findAll.html[findAll] and link:../ref/Tags/grep.html[grep] tags for these tasks: +If you have collections of objects you often need to sort and filter them. Use the xref:../ref/Tags/findAll.adoc[findAll] and xref:../ref/Tags/grep.adoc[grep] tags for these tasks: -[source,xml] +[,xml] ---- Stephen King's Books: @@ -8,7 +8,7 @@ Stephen King's Books: ---- -The `expr` attribute contains a Groovy expression that can be used as a filter. The link:../ref/Tags/grep.html[grep] tag does a similar job, for example filtering by class: +The `expr` attribute contains a Groovy expression that can be used as a filter. The xref:../ref/Tags/grep.adoc[grep] tag does a similar job, for example filtering by class: [source,xml] ---- diff --git a/src/main/docs/guide/tags/tagLogicAndIteration.adoc b/src/main/docs/guide/tags/tagLogicAndIteration.adoc index 9bc7512a94..79675b74c4 100644 --- a/src/main/docs/guide/tags/tagLogicAndIteration.adoc +++ b/src/main/docs/guide/tags/tagLogicAndIteration.adoc @@ -1,6 +1,6 @@ -GSP also supports logical and iterative tags out of the box. For logic there are link:../ref/Tags/if.html[if], link:../ref/Tags/else.html[else] and link:../ref/Tags/elseif.html[elseif] tags for use with branching: +GSP also supports logical and iterative tags out of the box. For logic there are xref:../ref/Tags/if.adoc[if], xref:../ref/Tags/else.adoc[else] and xref:../ref/Tags/elseif.adoc[elseif] tags for use with branching: -[source,xml] +[,xml] ---- <%-- show administrative functions --%> @@ -10,9 +10,9 @@ GSP also supports logical and iterative tags out of the box. For logic there are ---- -Use the link:../ref/Tags/each.html[each] and link:../ref/Tags/while.html[while] tags for iteration: +Use xref:../ref/Tags/each.adoc[each] and xref:../ref/Tags/while.adoc[while] tags for iteration: -[source,xml] +[,xml] ----

Number ${num}

diff --git a/src/main/docs/guide/tags/tagVariablesAndScopes.adoc b/src/main/docs/guide/tags/tagVariablesAndScopes.adoc index 3d65ed625b..d2613a8f2b 100644 --- a/src/main/docs/guide/tags/tagVariablesAndScopes.adoc +++ b/src/main/docs/guide/tags/tagVariablesAndScopes.adoc @@ -1,4 +1,4 @@ -Variables can be defined within a GSP using the link:../ref/Tags/set.html[set] tag: +Variables can be defined within a GSP using the xref:../ref/Tags/set.adoc[set] tag: [source,xml] ---- @@ -25,7 +25,7 @@ Variables can also be placed in one of the following scopes: * `page` - Scoped to the current page (default) * `request` - Scoped to the current request -* `flash` - Placed within link:{controllersRef}/flash.html[flash] scope and hence available for the next request +* `flash` - Placed within {controllersRef}/flash.html[flash] scope and hence available for the next request * `session` - Scoped for the user session * `application` - Application-wide scope. diff --git a/src/main/docs/guide/tags/tagsAsMethodCalls.adoc b/src/main/docs/guide/tags/tagsAsMethodCalls.adoc index 19a94ff758..e9a3e01e72 100644 --- a/src/main/docs/guide/tags/tagsAsMethodCalls.adoc +++ b/src/main/docs/guide/tags/tagsAsMethodCalls.adoc @@ -1,4 +1,5 @@ -One major different between GSP tags and other tagging technologies is that GSP tags can be called as either regular tags or as method calls from <>, <> or GSP views. +[[tagsAsMethodCalls,Tags as method calls]] +One major different between GSP tags and other tagging technologies is that GSP tags can be called as either regular tags or as method calls from {grailsdocs}guide/theWebLayer.html#controllers[controllers], xref:taglibs.adoc[tag libraries] or GSP views. ==== Tags as method calls from GSPs @@ -6,7 +7,7 @@ One major different between GSP tags and other tagging technologies is that GSP Tags return their results as a String-like object (a `StreamCharBuffer` which has all of the same methods as String) instead of writing directly to the response when called as methods. For example: -[source,xml] +[source,gsp] ---- Static Resource: ${createLinkTo(dir: "images", file: "logo.jpg")} ---- @@ -18,11 +19,11 @@ This is particularly useful for using a tag within an attribute: ---- -In view technologies that don't support this feature you have to nest tags within tags, which becomes messy quickly and often has an adverse effect of WYSIWYG tools such as Dreamweaver that attempt to render the mark-up as it is not well-formed: +In view technologies that don't support this feature you have to nest tags within tags, which becomes messy quickly and often has an adverse effect of WYSIWYG tools that attempt to render the mark-up as it is not well-formed: -[source,xml] +[,xml] ---- -" /> + ---- @@ -31,21 +32,21 @@ In view technologies that don't support this feature you have to nest tags withi You can also invoke tags from controllers and tag libraries. Tags within the default `g:` <> can be invoked without the prefix and a `StreamCharBuffer` result is returned: -[source,java] +[source,groovy] ---- def imageLocation = createLinkTo(dir:"images", file:"logo.jpg").toString() ---- Prefix the namespace to avoid naming conflicts: -[source,java] +[source,groovy] ---- def imageLocation = g.createLinkTo(dir:"images", file:"logo.jpg").toString() ---- -For tags that use a <>, use that prefix for the method call. For example (from the http://grails.org/plugin/fckeditor[FCK Editor plugin]): +For tags that use a <>, use that prefix for the method call. For example (from the https://github.com/stefanogualdi/grails-ckeditor[CK Editor plugin]): -[source,java] +[source,groovy] ---- -def editor = fckeditor.editor(name: "text", width: "100%", height: "400") +def editor = ckeditor.editor(name: "text", width: "100%", height: "400") ---- diff --git a/src/main/docs/guide/viewsAndTemplates.adoc b/src/main/docs/guide/viewsAndTemplates.adoc index 1f3572870b..a32980e615 100644 --- a/src/main/docs/guide/viewsAndTemplates.adoc +++ b/src/main/docs/guide/viewsAndTemplates.adoc @@ -14,7 +14,7 @@ Grails uses the convention of placing an underscore before the name of a view to
---- -Use the link:../ref/Tags/render.html[render] tag to render this template from one of the views in `grails-app/views/book`: +Use the xref:../ref/Tags/render.adoc[render] tag to render this template from one of the views in `grails-app/views/book`: [source,xml] ---- @@ -72,7 +72,7 @@ This can be expressed with the `tmpl` namespace as follows: You can also render templates from controllers using the link:{controllersRef}/render.html[render] controller method. This is useful for JavaScript heavy applications where you generate small HTML or data responses to partially update the current page instead of performing new request: -[source,java] +[source,groovy] ---- def bookData() { def b = Book.get(params.id) @@ -80,9 +80,9 @@ def bookData() { } ---- -The link:{controllersRef}/render.html[render] controller method writes directly to the response, which is the most common behaviour. To instead obtain the result of template as a String you can use the link:../ref/Tags/render.html[render] tag: +The link:{controllersRef}/render.html[render] controller method writes directly to the response, which is the most common behaviour. To instead obtain the result of template as a String you can use the xref:../ref/Tags/render.adoc[render] tag: -[source,java] +[source,groovy] ---- def bookData() { def b = Book.get(params.id) @@ -91,4 +91,4 @@ def bookData() { } ---- -Notice the usage of the `g` namespace which tells Grails we want to use the <> instead of the link:{controllersRef}/render.html[render] method. +Notice the usage of the `g` namespace which tells Grails we want to use the xref:tagsAsMethodCalls[tag as method call] instead of the {controllersRef}/render.html[render] method. diff --git a/src/main/docs/ref/Tag Libraries.adoc b/src/main/docs/ref/Tag Libraries.adoc index cddc3e087d..53709cb2bf 100644 --- a/src/main/docs/ref/Tag Libraries.adoc +++ b/src/main/docs/ref/Tag Libraries.adoc @@ -2,16 +2,15 @@ === Tag Library Usage -A tag library fulfills role of "view helper" in the Model View Controller (MVC) pattern and helps with GSP rendering. In Grails a tag library is a class with a name that ends in the convention "TagLib" and lives in the `grails-app/taglib` directory. Use the link:{commandLineRef}/create-taglib.html[create-taglib] command to create a tag library: +A tag library fulfills role of "view helper" in the Model View Controller (MVC) pattern and helps with GSP rendering. In Grails a tag library is a class with a name that ends in the convention "TagLib" and lives in the `grails-app/taglib` directory. Use the {commandLineRef}/create-taglib.html[create-taglib] command to create a tag library: -[source,java] ---- grails create-taglib format ---- or with your favourite IDE or text editor make a new file with the name `FormatTagLib` in `grails-app/taglib` as given below -[source,java] +[source,groovy] ---- import java.text.SimpleDateFormat diff --git a/src/main/docs/ref/Tag Libraries/actionName.adoc b/src/main/docs/ref/Tag Libraries/actionName.adoc index 4a3c276a9e..8dec1d766b 100644 --- a/src/main/docs/ref/Tag Libraries/actionName.adoc +++ b/src/main/docs/ref/Tag Libraries/actionName.adoc @@ -12,7 +12,7 @@ Returns the name of the currently executing action === Examples -[source,java] +[source,groovy] ---- class BookController { def list() { diff --git a/src/main/docs/ref/Tag Libraries/flash.adoc b/src/main/docs/ref/Tag Libraries/flash.adoc index 9f30ed5f83..a07518592a 100644 --- a/src/main/docs/ref/Tag Libraries/flash.adoc +++ b/src/main/docs/ref/Tag Libraries/flash.adoc @@ -31,4 +31,4 @@ class BookController { The flash object is a Map (a hash) which you can use to store key value pairs. These values are transparently stored inside the session and then cleared at the end of the next request. -This pattern lets you use HTTP redirects (which is useful for http://www.theserverside.com/tt/articles/article.tss?l=RedirectAfterPost[redirect after post]) and retain values that can be retrieved from the flash object. +This pattern lets you use HTTP redirects and retain values that can be retrieved from the flash object. diff --git a/src/main/docs/ref/Tag Libraries/pageScope.adoc b/src/main/docs/ref/Tag Libraries/pageScope.adoc index 84a580f2d1..b8ba6ccd6d 100644 --- a/src/main/docs/ref/Tag Libraries/pageScope.adoc +++ b/src/main/docs/ref/Tag Libraries/pageScope.adoc @@ -6,13 +6,13 @@ === Purpose -A reference to the binding of the GSP that the tag library is being executed within. Allows access to variables set with the link:../ref/Tags/set.html[set] tag and those passed to the page from the controller model. +A reference to the binding of the GSP that the tag library is being executed within. Allows access to variables set with the xref:../Tags/set.adoc[set] tag and those passed to the page from the controller model. === Examples -[source,java] +[source,groovy] ---- class BookTagLib { diff --git a/src/main/docs/ref/Tag Libraries/params.adoc b/src/main/docs/ref/Tag Libraries/params.adoc index 6b4cf06b32..fde2a8ca4f 100644 --- a/src/main/docs/ref/Tag Libraries/params.adoc +++ b/src/main/docs/ref/Tag Libraries/params.adoc @@ -22,7 +22,7 @@ class BookController { } ---- -To perform data binding (see link:theWebLayer.html#dataBinding[data binding] in the user guide): +To perform data binding (see {grailsdocs}guide/theWebLayer.html#dataBinding[data binding] in the user guide): [source,groovy] ---- @@ -35,15 +35,15 @@ def save() { === Description -The standard Servlet API provides access to parameters with the `HttpServletRequest` object. Although Grails provides the same capability through the link:{controllersRef}/request.html[request] object, it goes a bit further by providing a mutable map of request parameters called `params`. +The standard Servlet API provides access to parameters with the `HttpServletRequest` object. Although Grails provides the same capability through the {controllersRef}/request.html[request] object, it goes a bit further by providing a mutable map of request parameters called `params`. -The `params` object can be indexed into using the array index operator or de-reference operator, so given so given the URL `/hello?foo=bar` you can access `foo` with +The `params` object can be indexed into using the array index operator or de-reference operator, so given the URL `/hello?foo=bar` you can access `foo` with ---- println params.foo ---- -The params object can also be used to bind request parameters onto the properties of a domain class using either the constructor or the link:../ref/Domain%20Classes/properties.html[properties] property: +The params object can also be used to bind request parameters onto the properties of a domain class using either the constructor or the {grailsdocs}ref/Domain%20Classes/properties.html[properties] property: [source,groovy] ---- @@ -52,4 +52,4 @@ book = Book.get(1) book.properties = params ---- -For further reading see link:theWebLayer.html#dataBinding[data binding] in the user guide. +For further reading see {grailsdocs}guide/theWebLayer.html#dataBinding[data binding] in the user guide. diff --git a/src/main/docs/ref/Tag Libraries/request.adoc b/src/main/docs/ref/Tag Libraries/request.adoc index da68bc1daa..4ef0ac1fe3 100644 --- a/src/main/docs/ref/Tag Libraries/request.adoc +++ b/src/main/docs/ref/Tag Libraries/request.adoc @@ -6,7 +6,7 @@ === Purpose -The <> object is an instance of the Servlet API's http://docs.oracle.com/javaee/1.4/api/javax/servlet/http/HttpServletRequest.html[HttpServletRequest] class +The {grailsdocs}ref/Servlet%20API/request.html[request] object is an instance of the Servlet API's {javaee}javax/servlet/http/HttpServletRequest.html[HttpServletRequest] class === Examples @@ -27,6 +27,6 @@ class BookController { === Description -The http://docs.oracle.com/javaee/1.4/api/javax/servlet/http/HttpServletRequest.html[HttpServletRequest] class is useful for, amongst other things, obtaining request headers, storing request scoped attributes and establishing information about the client. Refer to the Servlet API's javadocs for further information. +The {javaee}javax/servlet/http/HttpServletRequest.html[HttpServletRequest] class is useful for, amongst other things, obtaining request headers, storing request scoped attributes and establishing information about the client. Refer to the Servlet API's javadocs for further information. -NOTE: The additional methods added to the <> object are documented in the Grails Servlet API reference guide +NOTE: The additional methods added to the {grailsdocs}ref/Servlet%20API/request.html[request] object are documented in the Grails Servlet API reference guide diff --git a/src/main/docs/ref/Tag Libraries/response.adoc b/src/main/docs/ref/Tag Libraries/response.adoc index e8b7aee6ae..b616f14784 100644 --- a/src/main/docs/ref/Tag Libraries/response.adoc +++ b/src/main/docs/ref/Tag Libraries/response.adoc @@ -6,7 +6,7 @@ === Purpose -The <> object is an instance of the Servlet API's http://docs.oracle.com/javaee/1.4/api/javax/servlet/http/HttpServletResponse.html[HttpServletResponse] class +The {grailsdocs}ref/Servlet%20API/response.html[response] object is an instance of the Servlet API's {javaee}javax/servlet/http/HttpServletResponse.html[HttpServletResponse] class === Examples @@ -26,6 +26,6 @@ class BookController { === Description -The Servlet API's `HttpServletResponse` class can be used within Grails to perform all typical activities such as writing out binary data, writing directly to the response and sending error response codes to name but a few. Refer to the documentation on the http://docs.oracle.com/javaee/1.4/api/javax/servlet/http/HttpServletResponse.html[HttpServletResponse] class in the Servlet API for more information. +The Servlet API's `HttpServletResponse` class can be used within Grails to perform all typical activities such as writing out binary data, writing directly to the response and sending error response codes to name but a few. Refer to the documentation on the {javaee}javax/servlet/http/HttpServletResponse.html[HttpServletResponse] class in the Servlet API for more information. -NOTE: The additional methods added to the <> object are documented in the Grails Servlet API reference guide +NOTE: The additional methods added to the {grailsdocs}ref/Servlet%20API/response.html[response] object are documented in the Grails Servlet API reference guide diff --git a/src/main/docs/ref/Tag Libraries/servletContext.adoc b/src/main/docs/ref/Tag Libraries/servletContext.adoc index 9f8488a083..16167c53cb 100644 --- a/src/main/docs/ref/Tag Libraries/servletContext.adoc +++ b/src/main/docs/ref/Tag Libraries/servletContext.adoc @@ -6,7 +6,7 @@ === Purpose -The <> object is an instance of the Servlet API's http://docs.oracle.com/javaee/1.4/api/javax/servlet/ServletContext.html[ServletContext] class. +The {grailsdocs}ref/Servlet%20API/servletContext.html[servletContext] object is an instance of the Servlet API's {javaee}javax/servlet/ServletContext.html[ServletContext] class. === Examples @@ -33,6 +33,6 @@ class BookController { === Description -The Servlet API's http://docs.oracle.com/javaee/1.4/api/javax/servlet/ServletContext.html[ServletContext] is useful for, amongst other things, storing global application attributes, reading local server resources and establishing information about the servlet container. +The Servlet API's {javaee}javax/servlet/ServletContext.html[ServletContext] is useful for, amongst other things, storing global application attributes, reading local server resources and establishing information about the servlet container. -NOTE: Grails adds additional methods to the standard Servlet API's <> object. See link for details. +NOTE: Grails adds additional methods to the standard Servlet API's {grailsdocs}ref/Servlet%20API/servletContext.html[servletContext] object. See link for details. diff --git a/src/main/docs/ref/Tag Libraries/session.adoc b/src/main/docs/ref/Tag Libraries/session.adoc index 890c248a1e..c69738a5f9 100644 --- a/src/main/docs/ref/Tag Libraries/session.adoc +++ b/src/main/docs/ref/Tag Libraries/session.adoc @@ -6,7 +6,7 @@ === Purpose -The <> object is an instance of the Servlet API's http://docs.oracle.com/javaee/1.4/api/javax/servlet/http/HttpSession.html[HttpSession] class +The {grailsdocs}ref/Servlet%20API/session.html[session] object is an instance of the Servlet API's {javaee}javax/servlet/http/HttpSession.html[HttpSession] class === Examples @@ -30,6 +30,6 @@ class UserController { === Description -The http://docs.oracle.com/javaee/1.4/api/javax/servlet/http/HttpSession.html[HttpSession] class is useful for associated session data with a client. +The {javaee}javax/servlet/http/HttpSession.html[HttpSession] class is useful for associated session data with a client. -NOTE: The additional methods added to the <> object are documented in the Grails Servlet API reference guide +NOTE: The additional methods added to the {grailsdocs}ref/Servlet%20API/session.html[session] object are documented in the Grails Servlet API reference guide diff --git a/src/main/docs/ref/Tags/actionSubmit.adoc b/src/main/docs/ref/Tags/actionSubmit.adoc index eb1315c326..b60392b910 100644 --- a/src/main/docs/ref/Tags/actionSubmit.adoc +++ b/src/main/docs/ref/Tags/actionSubmit.adoc @@ -12,7 +12,7 @@ Generates a submit button that maps to a specific action, which lets you have mu === Examples -[source,xml] +[,xml] ---- @@ -85,5 +85,5 @@ This isn't too much of a problem when the form URL does not include an action na where the action specified in the mapping is either the default action of the controller, or the action specified in the `` tag. -Also note that this tag relies on the multipart resolver to be able to inspect parameters included with multipart requests. If you disable the resolver by setting `grails.disableCommonsMultipart` to true in `application.groovy`, `actionSubmit` will not work. +Also note that this tag relies on the multipart resolver to be able to inspect parameters included with multipart requests. If you disable the resolver by setting `grails.disableCommonsMultipart` to true in the application configuration, `actionSubmit` will not work. diff --git a/src/main/docs/ref/Tags/actionSubmitImage.adoc b/src/main/docs/ref/Tags/actionSubmitImage.adoc index c40e5c9b4b..9d9a35c893 100644 --- a/src/main/docs/ref/Tags/actionSubmitImage.adoc +++ b/src/main/docs/ref/Tags/actionSubmitImage.adoc @@ -28,4 +28,4 @@ Attributes * `src` - The source of the image to use * `action` (optional) - The name of the action to be executed -WARNING: You cannot use multiple actionSubmitImage tags within the same form and have it work in Internet Explorer 6 or 7 unless you add some custom JavaScript. See http://www.quirksmode.org/bugreports/archives/2006/07/Namevalue_pairs_arent_submitted_for_image_submit_b.html[this page] for a bit more information and a workaround. +WARNING: You cannot use multiple actionSubmitImage tags within the same form and have it work in Internet Explorer 6 or 7 unless you add some custom JavaScript. See https://www.quirksmode.org/bugreports/archives/2006/07/Namevalue_pairs_arent_submitted_for_image_submit_b.html[this page] for a bit more information and a workaround. diff --git a/src/main/docs/ref/Tags/applyLayout.adoc b/src/main/docs/ref/Tags/applyLayout.adoc index c3e631804c..ee5ec22322 100644 --- a/src/main/docs/ref/Tags/applyLayout.adoc +++ b/src/main/docs/ref/Tags/applyLayout.adoc @@ -21,7 +21,7 @@ or [source,xml] ---- - + ---- or @@ -44,7 +44,7 @@ Attributes * `url` - (optional) The URL to retrieve the content from and apply a layout to * `contentType` (optional) - The content type to use, default is "text/html" * `encoding` (optional) - The encoding to use -* `params` (optional) - The params to pass onto the page object (retrievable with the link:pageProperty.html[pageProperty] tag) +* `params` (optional) - The params to pass onto the page object (retrievable with the xref:pageProperty.adoc[pageProperty] tag) * `model` (optional) - The model (as java.util.Map) to pass to the view and layout templates diff --git a/src/main/docs/ref/Tags/collect.adoc b/src/main/docs/ref/Tags/collect.adoc index 96fa99802e..b4aad45b58 100644 --- a/src/main/docs/ref/Tags/collect.adoc +++ b/src/main/docs/ref/Tags/collect.adoc @@ -12,7 +12,7 @@ Uses the Groovy JDK `collect` method to iterate over each element of the specifi === Examples -[source,xml] +[,xml] ---- Books titles: diff --git a/src/main/docs/ref/Tags/cookie.adoc b/src/main/docs/ref/Tags/cookie.adoc index 8f80e4d795..9f6fe0213d 100644 --- a/src/main/docs/ref/Tags/cookie.adoc +++ b/src/main/docs/ref/Tags/cookie.adoc @@ -14,7 +14,7 @@ Obtains the value of a named cookie Reading a cookie's value: -[source,xml] +[,xml] ---- Hello ---- diff --git a/src/main/docs/ref/Tags/country.adoc b/src/main/docs/ref/Tags/country.adoc index f14081a0da..7ae211ddbe 100644 --- a/src/main/docs/ref/Tags/country.adoc +++ b/src/main/docs/ref/Tags/country.adoc @@ -12,7 +12,7 @@ Renders the default English name for a given ISO3166_3 3-letter country code === Examples -[source,xml] +[,xml] ---- Country: Supported countries: , @@ -22,7 +22,7 @@ Supported countries: , === Description -Uses the internal ISO3166_3 country code date that the link:countrySelect.html[countrySelect] tag is based upon, to quickly render the name of a country given the code. +Uses the internal ISO3166_3 country code date that the xref:countrySelect.adoc[countrySelect] tag is based upon, to quickly render the name of a country given the code. For internationalized versions of the country names, define these in your message bundles and use the `` tag instead. diff --git a/src/main/docs/ref/Tags/countrySelect.adoc b/src/main/docs/ref/Tags/countrySelect.adoc index 788f614406..c6c7d1a275 100644 --- a/src/main/docs/ref/Tags/countrySelect.adoc +++ b/src/main/docs/ref/Tags/countrySelect.adoc @@ -12,24 +12,26 @@ Generates an HTML select tag with Country names. === Examples -[source,xml] +[,xml] ---- -// create a select for all countries + -// create select from a list of ISO3166_3 country codes + -// create country select with internationalized labels -// expected properties in messages.properties: -// countryname.gbr=My United Kingdom -// countryname.usa=Home of the brave -// countryname.deu=Germany + ---- @@ -46,7 +48,7 @@ Attributes * `from` (optional) - The list or range to select from * `value` (optional) - The current selected value that evaluates `equals()` to `true` for one of the elements in the from list. * `default` (optional) - The ISO code of the default country to display if `value` is not set -* `noSelection` (optional) - A single-entry Map detailing the key and value to use for the "no selection made" choice in the select box. If there is no current selection this will be shown as it is first in the list, and if submitted with this selected, the key that you provide will be submitted. Typically this will be blank - but you can also use 'null' in the case that you're passing the ID of an object +* `noSelection` (optional) - A single-entry Map detailing the key and value to use for the "no selection made" choice in the select box. If there is no current selection this will be shown as it is first in the list, and if submitted with this selected, the key that you provide will be submitted. Typically, this will be blank - but you can also use 'null' in the case that you're passing the ID of an object * `valueMessagePrefix` (optional) - By default the value "option" element will be the internal English name of the country according to the ISO3166_3 standard. Setting this allows the value to be resolved from the I18n messages. The valueMessagePrefix will be suffixed with a dot ('.') and then the country code of the option to resolve the message. If the message could not be resolved, the prefix plus country code is presented. diff --git a/src/main/docs/ref/Tags/createLink.adoc b/src/main/docs/ref/Tags/createLink.adoc index 4efbdcf023..5eb9c0ff2d 100644 --- a/src/main/docs/ref/Tags/createLink.adoc +++ b/src/main/docs/ref/Tags/createLink.adoc @@ -14,7 +14,7 @@ Creates a link that can be used where necessary (for example in an href, JavaScr Example controller for an application called "shop": -[source,java] +[source,groovy] ---- class BookController { @@ -32,40 +32,40 @@ class BookController { Example usages for above controller: -[source,xml] +[,xml] ---- -// generates "/shop/book/show/1" + -// generates "/shop/book/show?foo=bar&boo=far" + -// generates "/shop/book" + -// generates "/shop/book/list" + -// generates "/shop/book/list" + -// generates a link tot he book controller in the publishing namespace + -// generates "http://portal.mygreatsite.com/book" + -// generates "http://admin.mygreatsite.com/book" + -// generates "/shop/book/list/1?title=The+Shining&author=Stephen+King" + ---- Example as a method call in GSP: -[source,java] +[,xml] ---- my link ---- @@ -89,13 +89,13 @@ Attributes * `plugin` (optional) - the name of the plugin which provides the controller * `id` (optional) - The id to use in the link * `fragment` (optional) - The link fragment (often called anchor tag) to use -* `mapping` (optional) - The <> to use to rewrite the link +* `mapping` (optional) - The {grailsdocs}guide/theWebLayer.html#namedMappings[named URL mapping] to use to rewrite the link * `method` (optional) - The HTTP method specified in the corresponding URL mapping * `params` (optional) - A Map of request parameters * `url` (optional) - A Map containing the action,controller,id etc. * `uri` (optional) - A string for a relative path in the running app. * `relativeUri` (optional) - Used to specify a uri relative to the current path. -* `absolute` (optional) - If `true` will prefix the link target address with the value of the `grails.serverURL` property from `application.groovy`, or http://localhost: if there is no setting in `application.groovy` and not running in production. +* `absolute` (optional) - If `true` will prefix the link target address with the value of the `grails.serverURL` property from the application configuration, or http://localhost: if there is no setting in the config and not running in production. * `base` (optional) - Sets the prefix to be added to the link target address, typically an absolute server URL. This overrides the behaviour of the `absolute` property if both are specified. * `event` (optional) - The name of a Webflow event to trigger for the flow associated with the given `action`. Requires the Webflow plugin. diff --git a/src/main/docs/ref/Tags/createLinkTo.adoc b/src/main/docs/ref/Tags/createLinkTo.adoc index d38898ef86..b7b493ed10 100644 --- a/src/main/docs/ref/Tags/createLinkTo.adoc +++ b/src/main/docs/ref/Tags/createLinkTo.adoc @@ -2,7 +2,7 @@ == createLinkTo -WARNING: Deprecated: Use link:resource.html[resource] instead. +WARNING: Deprecated: Use xref:resource.adoc[resource] instead. === Purpose @@ -18,16 +18,16 @@ Example controller for an application called "shop": Example usages for the "shop" app: -[source,xml] +[,xml] ---- -// generates "/shop/css/main.css" + -// generates "http://portal.mygreatsite.com/css/main.css" + -// generates "http://admin.mygreatsite.com/css/main.css" - + + ---- Example as a method call in GSP only: @@ -52,6 +52,6 @@ Attributes * `dir` (optional) - the name of the directory containing the resource * `file` (optional) - the name of the resource file -* `absolute` (optional) - If `true` will prefix the link target address with the value of the `grails.serverURL` property from `application.groovy`, or http://localhost: if there is no setting in `application.groovy` and not running in production. +* `absolute` (optional) - If `true` will prefix the link target address with the value of the `grails.serverURL` property from the application configuration, or http://localhost: if there is no setting in the config and not running in production. * `base` (optional) - Sets the prefix to be added to the link target address, typically an absolute server URL. This overrides the behaviour of the `absolute` property if both are specified. diff --git a/src/main/docs/ref/Tags/currencySelect.adoc b/src/main/docs/ref/Tags/currencySelect.adoc index b81aa00ec9..bc0c515b49 100644 --- a/src/main/docs/ref/Tags/currencySelect.adoc +++ b/src/main/docs/ref/Tags/currencySelect.adoc @@ -6,7 +6,7 @@ === Purpose -Generates an HTML select tag with currency symbols (e.g. 'EUR', 'USD', etc.). +Generates an HTML select tag with currency symbols (e.g. 'EUR', 'USD', etc.) === Examples @@ -24,5 +24,5 @@ Generates an HTML select tag with currency symbols (e.g. 'EUR', 'USD', etc.). Attributes * `from` (optional) - The currency symbols to select from, defaults to the major ones if not specified -* `value` (optional) - The currency value as the currency code. Defaults to the currency for the current Locale if not specified +* `value` (optional) - The currency value as the currency code. Defaults to the currency for the current {javase}java.base/java/util/Locale.html[Locale] if not specified diff --git a/src/main/docs/ref/Tags/datePicker.adoc b/src/main/docs/ref/Tags/datePicker.adoc index cc65c83a47..2b0d2ec194 100644 --- a/src/main/docs/ref/Tags/datePicker.adoc +++ b/src/main/docs/ref/Tags/datePicker.adoc @@ -12,7 +12,7 @@ Creates a date picker which renders as HTML select tags for the day, month, year === Examples -[source,xml] +[,xml] ---- @@ -38,7 +38,7 @@ Attributes * `name` (required) - The name of the date picker field set * `value` (optional) - The current value of the date picker; defaults to either the value specified by the `default` attribute or _now_ if no `default` is set. -* `default` (optional) - A https://docs.oracle.com/javase/8/docs/api/java/util/Date.html[Date] or parsable date string (see https://docs.oracle.com/javase/8/docs/api/java/text/DateFormat.html[DateFormat]) that will be used if there is no `value` +* `default` (optional) - A {javase}java.base/java/util/Date.html[Date] or parsable date string (see {javase}java.base/java/text/DateFormat.html[DateFormat]) that will be used if there is no `value` * `precision` (optional) - The desired granularity of the date to be rendered ** Valid values are 'year', 'month', 'day', 'hour', or 'minute' ** Defaults to 'minute' if not specified @@ -47,7 +47,7 @@ Attributes *** day = 1st day of the month *** hour = 00 *** minute = 00 -* `noSelection` (optional) - A single-entry Map detailing the key and value to use for the "no selection made" choice in the select box. If there is no current selection this will be shown as it is first in the list, and if submitted with this selected, the key that you provide will be submitted. Typically this will be blank. +* `noSelection` (optional) - A single-entry Map detailing the key and value to use for the "no selection made" choice in the select box. If there is no current selection this will be shown as it is first in the list, and if submitted with this selected, the key that you provide will be submitted. Typically, this will be blank. * `years` (optional) - A list or range of years to display, in the order specified. i.e. specify 2007..1900 for a reverse order list going back to 1900. If this attribute is not specified, a range of years from the current year + 100 to current year - 100 will be shown. * `relativeYears` (optional) - A range of int representing values relative to `value`. For example, a `relativeYears` of [-2..7] and a `value` of today will render a list of 10 years starting with 2 years ago through 7 years in the future. This can be useful for things like credit card expiration dates or birth dates which should be bound relative to today. - +* `locale` (optional) - The locale to use for display formatting. Defaults to the locale of the current request. If no request locale is specified, it will then fall back to the system's default locale. A {javase}java.base/java/util/Locale.html[Locale] or parsable locale String ('en_US') value. diff --git a/src/main/docs/ref/Tags/each.adoc b/src/main/docs/ref/Tags/each.adoc index d763c1d358..5a38d05795 100644 --- a/src/main/docs/ref/Tags/each.adoc +++ b/src/main/docs/ref/Tags/each.adoc @@ -2,7 +2,7 @@ === Purpose -Uses a "for(var in collection)" loop to iterate over each element of the specified object. +Uses a `for(var in collection)` loop to iterate over each element of the specified object. === Examples diff --git a/src/main/docs/ref/Tags/eachError.adoc b/src/main/docs/ref/Tags/eachError.adoc index 0f95898a76..86d89d9ea0 100644 --- a/src/main/docs/ref/Tags/eachError.adoc +++ b/src/main/docs/ref/Tags/eachError.adoc @@ -12,7 +12,7 @@ Loops through each error of the specified bean or model. If no arguments are spe === Examples -Loop through each error in the "book" bean: +Loop through each error in the `book` bean: [source,xml] ---- @@ -21,7 +21,7 @@ Loop through each error in the "book" bean: ---- -Loop through each error in the title field of the "book" bean: +Loop through each error in the title field of the `book` bean: [source,xml] ---- diff --git a/src/main/docs/ref/Tags/else.adoc b/src/main/docs/ref/Tags/else.adoc index 276c7da854..2bbc4b9747 100644 --- a/src/main/docs/ref/Tags/else.adoc +++ b/src/main/docs/ref/Tags/else.adoc @@ -12,7 +12,7 @@ The logical else tag === Examples -[source,xml] +[,xml] ---- Hello Fred! diff --git a/src/main/docs/ref/Tags/elseif.adoc b/src/main/docs/ref/Tags/elseif.adoc index 2e277047f6..4e2618eb68 100644 --- a/src/main/docs/ref/Tags/elseif.adoc +++ b/src/main/docs/ref/Tags/elseif.adoc @@ -12,7 +12,7 @@ The logical elseif tag === Examples -[source,xml] +[,xml] ---- Hello Fred! diff --git a/src/main/docs/ref/Tags/external.adoc b/src/main/docs/ref/Tags/external.adoc index b7cc643277..298928ab3c 100644 --- a/src/main/docs/ref/Tags/external.adoc +++ b/src/main/docs/ref/Tags/external.adoc @@ -10,7 +10,7 @@ Renders the appropriate HTML linking markup for an external resource such as a C This is a convenience that takes the boilerplate out of the often verbose `` and ` Page to be decorated @@ -27,11 +27,11 @@ Example decorated page: Example decorator layout: -[source,xml] +[source,html] ---- - @@ -40,12 +40,12 @@ Example decorator layout: Results in: -[source,xml] +[source,html] ---- - + Page to be decorated diff --git a/src/main/docs/ref/Tags/layoutHead.adoc b/src/main/docs/ref/Tags/layoutHead.adoc index f56584e2ec..725f16ca96 100644 --- a/src/main/docs/ref/Tags/layoutHead.adoc +++ b/src/main/docs/ref/Tags/layoutHead.adoc @@ -1,4 +1,3 @@ - == layoutHead @@ -14,12 +13,12 @@ Used in layouts to render the contents of the head tag of the decorated page. Eq Example decorated page: -[source,xml] +[source,html] ---- - Page to be decorated @@ -27,11 +26,11 @@ Example decorated page: Example decorator layout: -[source,xml] +[source,html] ---- - @@ -40,12 +39,12 @@ Example decorator layout: Results in: -[source,xml] +[source,html] ---- - + Page to be decorated diff --git a/src/main/docs/ref/Tags/layoutTitle.adoc b/src/main/docs/ref/Tags/layoutTitle.adoc index 2b96fc2bda..84d24a942b 100644 --- a/src/main/docs/ref/Tags/layoutTitle.adoc +++ b/src/main/docs/ref/Tags/layoutTitle.adoc @@ -14,13 +14,13 @@ Used in layouts to render the contents of the title tag of the decorated page. E Example decorated page: -[source,xml] +[source,html] ---- Hello World! - Page to be decorated @@ -28,12 +28,12 @@ Example decorated page: Example decorator layout: -[source,xml] +[source,html] ---- <g:layoutTitle default="Some Title" /> - @@ -41,13 +41,13 @@ Example decorator layout: ---- Results in: -[source,xml] +[source,html] ---- Hello World! - + Page to be decorated diff --git a/src/main/docs/ref/Tags/link.adoc b/src/main/docs/ref/Tags/link.adoc index d57116fd9d..9d1998d333 100644 --- a/src/main/docs/ref/Tags/link.adoc +++ b/src/main/docs/ref/Tags/link.adoc @@ -14,7 +14,7 @@ Creates an html anchor tag with the `href` set based on the specified parameters Example controller for an application called "shop": -[source,java] +[source,groovy] ---- class BookController { def list() { @@ -29,7 +29,7 @@ class BookController { Example usages for above controller: -[source,xml] +[,xml] ---- Book 1 @@ -57,14 +57,14 @@ Example usages for above controller: Example Usage for a RESTful Resource: -[source,java] +[,groovy] ---- static mappings = { "/books"(resources: 'book') } ---- -[source,xml] +[,xml] ---- Book Home Book Show @@ -73,7 +73,7 @@ static mappings = { Example as a method call in GSP only: -[source,java] +[,gsp] ---- <%= link(action:'list',controller:'book') { 'Book List' }%> ---- @@ -99,13 +99,13 @@ Attributes * `elementId` (optional) - this value will be used to populate the `id` attribute of the generated href * `id` (optional) - the id to use in the link * `fragment` (optional) - The link fragment (often called anchor tag) to use -* `mapping` (optional) - The <> to use to rewrite the link +* `mapping` (optional) - The {grailsdocs}guide/theWebLayer.html#namedMappings[named URL mapping] to use to rewrite the link * `method` (optional) - The HTTP method specified in the corresponding URL mapping * `params` (optional) - a Map of request parameters * `uri` (optional) - a relative URI * `relativeUri` (optional) - Used to specify a uri relative to the current path. * `url` (optional) - a Map containing the action, controller, id etc. -* `absolute` (optional) - If `true` will prefix the link target address with the value of the `grails.serverURL` property from `application.groovy`, or http://localhost: if there is no setting in `application.groovy` and not running in production. +* `absolute` (optional) - If `true` will prefix the link target address with the value of the `grails.serverURL` property from the application configuration, or http://localhost: if there is no setting in the config and not running in production. * `base` (optional) - Sets the prefix to be added to the link target address, typically an absolute server URL. This overrides the behaviour of the `absolute` property, if both are specified. * `event` (optional) - The name of a Webflow event to trigger for the flow associated with the given `action`. Requires the Webflow plugin. diff --git a/src/main/docs/ref/Tags/localeSelect.adoc b/src/main/docs/ref/Tags/localeSelect.adoc index 830fee2770..0a0d1b403a 100644 --- a/src/main/docs/ref/Tags/localeSelect.adoc +++ b/src/main/docs/ref/Tags/localeSelect.adoc @@ -6,7 +6,7 @@ === Purpose -Generates an HTML select with `Locale`s as values +Generates an HTML select with ``Locale``s as values === Examples @@ -14,7 +14,7 @@ Generates an HTML select with `Locale`s as values [source,xml] ---- -// create a locale select + ---- @@ -25,6 +25,7 @@ Generates an HTML select with `Locale`s as values Attributes * `name` - The name to be used for the select box -* `value` (optional) - The selected `Locale`; defaults to the current request locale if not specified +* `value` (optional) - The selected {javase}java.base/java/util/Locale.html[Locale]; defaults to the current request locale if not specified +* `locale` (optional) - The {javase}java.base/java/util/Locale.html[Locale] to use for formatting the locale names. Defaults to the current request locale and then the system default locale if not specified diff --git a/src/main/docs/ref/Tags/message.adoc b/src/main/docs/ref/Tags/message.adoc index 4690cb642e..025cb278d0 100644 --- a/src/main/docs/ref/Tags/message.adoc +++ b/src/main/docs/ref/Tags/message.adoc @@ -6,7 +6,7 @@ === Purpose -Resolves a message from the given code or error. Normally used in conjunction with link:eachError.html[eachError] +Resolves a message from the given code or error. Normally used in conjunction with xref:eachError.adoc[eachError] === Examples @@ -37,7 +37,7 @@ Output a message for a compatible object. ---- -NOTE: Objects passed to the message parameter must implement the http://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/context/MessageSourceResolvable.html[MessageSourceResolvable] interface. +NOTE: Objects passed to the message parameter must implement the {springapi}org/springframework/context/MessageSourceResolvable.html[MessageSourceResolvable] interface. === Description @@ -57,7 +57,7 @@ One of either the `error` attribute, the `code` attribute or the `message` attri For a more complex example, to output your own message with parameters and a default message, you might use the following code from your controller: -[source,java] +[source,groovy] ---- flash.message = "book.delete.message" flash.args = ["The Stand"] @@ -66,7 +66,7 @@ flash.default = "book deleted" You would then specify the following in messages.properties: -[source,java] +[source,groovy] ---- book.delete.message="Book {0} deleted." ---- diff --git a/src/main/docs/ref/Tags/meta.adoc b/src/main/docs/ref/Tags/meta.adoc index 09bf748674..0ecba17e80 100644 --- a/src/main/docs/ref/Tags/meta.adoc +++ b/src/main/docs/ref/Tags/meta.adoc @@ -12,7 +12,7 @@ Renders application metadata properties. === Examples -[source,xml] +[,xml] ---- Version Built with Grails diff --git a/src/main/docs/ref/Tags/pageProperty.adoc b/src/main/docs/ref/Tags/pageProperty.adoc index be78de1e1d..9d47c48d65 100644 --- a/src/main/docs/ref/Tags/pageProperty.adoc +++ b/src/main/docs/ref/Tags/pageProperty.adoc @@ -14,23 +14,23 @@ Used in layouts to output the contents a property of the decorated page. Equival Example decorated page: -[source,xml] +[source,html] ---- - + - + + Page to be decorated ---- Example decorator layout: -[source,xml] +[source,html] ---- - @@ -38,12 +38,12 @@ Example decorator layout: ---- Results in: -[source,xml] +[source,html] ---- - + Page to be decorated diff --git a/src/main/docs/ref/Tags/paginate.adoc b/src/main/docs/ref/Tags/paginate.adoc index fb781f207f..3983f59611 100644 --- a/src/main/docs/ref/Tags/paginate.adoc +++ b/src/main/docs/ref/Tags/paginate.adoc @@ -14,7 +14,7 @@ Creates next/previous buttons and a breadcrumb trail for pagination of results Example domain class: -[source,java] +[source,groovy] ---- class Book { String title @@ -24,7 +24,7 @@ class Book { Example controller: -[source,java] +[source,groovy] ---- class BookController { def list() { @@ -68,7 +68,7 @@ Attributes * `omitLast` (optional) - If set to true, the last page link will only be shown when the last page is within the offset * `max` (optional) - The number of records to display per page (defaults to 10). Used ONLY if `params.max` is empty * `maxsteps` (optional) - The number of steps displayed for pagination (defaults to 10). Used ONLY if `params.maxsteps` is empty -* `mapping` (optional) - The <> to use to rewrite the link +* `mapping` (optional) - The {grailsdocs}guide/theWebLayer.html#namedMappings[named URL mapping] to use to rewrite the link * `offset` (optional) - Used ONLY if `params.offset` is empty diff --git a/src/main/docs/ref/Tags/passwordField.adoc b/src/main/docs/ref/Tags/passwordField.adoc index f43b142d23..7b4a16463e 100644 --- a/src/main/docs/ref/Tags/passwordField.adoc +++ b/src/main/docs/ref/Tags/passwordField.adoc @@ -6,7 +6,7 @@ === Purpose -Creates a input of type 'password' (a password field). An implicit "id" attribute is given the same value as name unless you explicitly specify one. +Creates an input of type 'password' (a password field). An implicit `id` attribute is given the same value as name unless you explicitly specify one. === Examples diff --git a/src/main/docs/ref/Tags/radio.adoc b/src/main/docs/ref/Tags/radio.adoc index c4dc1171cb..e4a79f8df4 100644 --- a/src/main/docs/ref/Tags/radio.adoc +++ b/src/main/docs/ref/Tags/radio.adoc @@ -12,7 +12,7 @@ Generates a radio button === Examples -[source,xml] +[,xml] ---- @@ -20,7 +20,7 @@ Generates a radio button results in: -[source,xml] +[source,html] ---- diff --git a/src/main/docs/ref/Tags/radioGroup.adoc b/src/main/docs/ref/Tags/radioGroup.adoc index 878bb65520..825ddbe48f 100644 --- a/src/main/docs/ref/Tags/radioGroup.adoc +++ b/src/main/docs/ref/Tags/radioGroup.adoc @@ -14,14 +14,14 @@ Generates radio button groups [source,xml] ---- - +

: ${it.radio}

---- results in: -[source,xml] +[source,html] ----

Radio 1:

Radio 2:

@@ -39,7 +39,7 @@ results in: results in: -[source,xml] +[source,html] ----

Yes!

Of course!

diff --git a/src/main/docs/ref/Tags/render.adoc b/src/main/docs/ref/Tags/render.adoc index a611964b8e..9f996c049f 100644 --- a/src/main/docs/ref/Tags/render.adoc +++ b/src/main/docs/ref/Tags/render.adoc @@ -14,7 +14,7 @@ Applies an inbuilt or user-defined Groovy template against a model so that templ Example domain class: -[source,java] +[source,groovy] ---- class Book { String title @@ -24,13 +24,13 @@ class Book { Example template: -[source,java] +[,xml] ----

${it.title}

${it.author}

---- -This template can now be reused whether you have a `List` of `Book`s or a single `Book`. For a `List` the template will be repeated for each instance: +This template can now be reused whether you have a `List` of ``Book``s or a single `Book`. For a `List` the template will be repeated for each instance: [source,xml] ---- @@ -46,7 +46,7 @@ and for a single instance the template is rendered once: You can also create a template for a particular type of model. For example this template: -[source,xml] +[,xml] ----

${book.title}

${author.fullName}

@@ -65,7 +65,7 @@ It is also possible to define the name of the variable to be used by the templat Example template: -[source,java] +[,xml] ----

${myBook.title}

${myBook.author}

@@ -82,7 +82,7 @@ Example render tag call for the above template === Description -Note that if the value of the template attribute starts with a '/' it will be resolved relative to the views directory. This is useful for sharing templates between views. Without the leading '/' it will be first be resolved relative to the current controller's view directory then, failing that, the top level views directory. In either case the template file must be named with a leading underscore ('_') but referenced in the template attribute without that underscore or the '.gsp' suffix. +Note that if the value of the template attribute starts with a '/' it will be resolved relative to the `views` directory. This is useful for sharing templates between views. Without the leading '/' it will be first be resolved relative to the current controller's view directory then, failing that, the top level views directory. In either case the template file must be named with a leading underscore ('_') but referenced in the template attribute without that underscore or the '.gsp' suffix. Attributes @@ -94,6 +94,6 @@ Attributes * `var` (optional) - The variable name of the bean to be referenced in the template * `plugin` (optional) - The plugin to look for the template in -See link:{controllersRef}/render.html[render] in the user guide for more information. +See {controllersRef}/render.html[render] in the Grails user guide for more information. diff --git a/src/main/docs/ref/Tags/resource.adoc b/src/main/docs/ref/Tags/resource.adoc index 17236dac92..c7451490b5 100644 --- a/src/main/docs/ref/Tags/resource.adoc +++ b/src/main/docs/ref/Tags/resource.adoc @@ -8,7 +8,7 @@ Generates a link (URI) string. Can be used in an href, JavaScript, Ajax call, etc. -This tag is aware of the http://grails.org/plugin/resources[Resources plugin], and if it's installed the tag will correctly generate links to static resources processed by the plugin. +This tag is aware of the Resources plugin, and if it's installed the tag will correctly generate links to static resources processed by the plugin. === Examples @@ -16,16 +16,16 @@ This tag is aware of the http://grails.org/plugin/resources[Resources plugin], a Example usages for the "shop" app: -[source,xml] +[,xml] ---- -// generates "/shop/css/main.css" + -// generates "http://portal.mygreatsite.com/css/main.css" + -// generates "http://admin.mygreatsite.com/css/main.css" - + + ---- Example as a method call in GSP only: @@ -52,6 +52,6 @@ Attributes * `contextPath` (optional) - the context path to use (relative to the application context path). Defaults to "" or path to the plugin for a plugin view or template. * `dir` (optional) - the name of the directory containing the resource * `file` (optional) - the name of the resource file -* `absolute` (optional) - If `true` will prefix the link target address with the value of the `grails.serverURL` property from `application.groovy`, or http://localhost: if there is no setting in `application.groovy` and not running in production. +* `absolute` (optional) - If `true` will prefix the link target address with the value of the `grails.serverURL` property from the application configuration, or http://localhost: if there is no setting in the config and not running in production. * `plugin` (optional) - The plugin to look for the resource in diff --git a/src/main/docs/ref/Tags/select.adoc b/src/main/docs/ref/Tags/select.adoc index 3e16b85d02..5fb070157a 100644 --- a/src/main/docs/ref/Tags/select.adoc +++ b/src/main/docs/ref/Tags/select.adoc @@ -12,47 +12,51 @@ Generates HTML selects. === Examples -[source,xml] +[,xml] ---- -// create a select from a range + + noSelection="['':'-Choose your age-']" /> -// use a no selection with a nullable Object property (use 'null' as key) + + optionKey="id" optionValue="name" /> -// create select from a list of companies -// note the 'optionKey' is set to the id of each company element + -// create multiple select + -// create select with internationalized labels (this is -// useful for small static lists and the inList constraint). -// expected properties in messages.properties: -// book.category.M=Mystery -// book.category.T=Thriller -// book.category.F=Fantasy + ---- Example as a method call in GSP only: -[source,xml] +[,gsp] ---- -${select(from:aList,value:aValue)} +${select(from:aList, value:aValue)} ---- @@ -67,16 +71,17 @@ Attributes * `optionKey` (optional) - By default, the `value` attribute of each `