Skip to content

Commit

Permalink
renderText example
Browse files Browse the repository at this point in the history
  • Loading branch information
codeconsole committed Dec 12, 2024
1 parent e70557b commit 7464298
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ class DemoController {
render view:'index', layout: 'bootstrap5'
}

def renderText() {
render text: '<p>Hello World</p>', contentType: 'text/html'
}

def chaining() {} // Multiple layouts
def jsp() { render view:'hello' } // JSP page with layout
def viewException() {} // Exception in a view
Expand Down
1 change: 1 addition & 0 deletions grails-app/views/layouts/bootstrap5.gsp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
<li><a href="/demo/index" class="nav-link px-2${actionName == 'index'?" link-secondary":""}">Forced Layout</a></li>
<li><a href="/demo/chaining" class="nav-link px-2${actionName == 'chaining'?" link-secondary":""}">Decorator Chaining</a></li>
<li><a href="/demo/jsp" class="nav-link px-2${actionName == 'jsp'?" link-secondary":""}">JSP Demo</a></li>
<li><a href="/demo/renderText" class="nav-link px-2" target="_blank">Text</a></li>
<li><a href="/demo/exception" class="nav-link px-2${actionName == 'exception'?" link-secondary":""}">Controller 500 Example</a></li>
<li><a href="/demo/viewException" class="nav-link px-2${actionName == 'viewException'?" link-secondary":""}">View 500 Example</a></li>
<li><a href="/demo/404" class="nav-link px-2${response.status == 404?" link-secondary":""}">404 Error</a></li>
Expand Down

0 comments on commit 7464298

Please sign in to comment.