Grails
  1. Grails
  2. GRAILS-8278

The tag g:include is not passing the model to the view correctly

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0-RC1
    • Fix Version/s: 2.0-RC2
    • Component/s: TagLib
    • Labels:
    • Environment:
      MacOSX

      Description

      I have been struggling with these for a few hours now, and have come to the
      conclusion that it may be a bug with the 2.0.0.RC1.

      At first I thought it was the project I was working on, but then I created a
      complete new project and was able to recreate the bug. Am using grails
      2.0.0.RC1.

      The bug presents itself when I try to include a model object in a GSP, for
      example:

      hello/index.gsp
                             <p>This data is coming from the model:</p>
                             <p>content: ${content}</p>
                             <g:include model="${otherModel}" view="/hello/include.gsp" />
      

      Now in my action I have something like:

      grails-app/controllers/HelloController.groovy
      package helloworld
      
      class HelloController {
      
         def index() {
      
                     def model = [:]
                     model.content = 'content...'
      
                     def includeModel = [:]
                     includeModel.content = 'includeModel...'
      
                     model.otherModel = includeModel
      
                     render( view:'index', model:model )
             }
      }
      

      The /hello/include.gsp file contains the following:

      hello/include.gsp
      <p>This data is coming from the included model:</p>
      <p>content: ${content}</p>
      

      But, what shows up on the page is not what I am expecting, this is what
      shows on the page:

      http://localhost:8080/helloworld/hello/index

      This data is coming from the model:
      content: content...
      This data is coming from the included model:
      content: content...

      Any ideas?Any help is greatly appreciated.

      Thanks,
      -Cesar

        Activity

        Hide
        Jeff Scott Brown added a comment -

        I am reformatting some of the code in the original description as it is hard to evaluate otherwise.

        Show
        Jeff Scott Brown added a comment - I am reformatting some of the code in the original description as it is hard to evaluate otherwise.
        Hide
        Graeme Rocher added a comment -

        The issue uncovered a security hole GRAILS-8283 which has been now fixed, however this does mean that GSPs are not accessible directly. I'm working on making them accessible for include requests then will try and address the underlying issue.

        Show
        Graeme Rocher added a comment - The issue uncovered a security hole GRAILS-8283 which has been now fixed, however this does mean that GSPs are not accessible directly. I'm working on making them accessible for include requests then will try and address the underlying issue.
        Hide
        Graeme Rocher added a comment -

        Fixed. Thanks for the report.

        Show
        Graeme Rocher added a comment - Fixed. Thanks for the report.

          People

          • Assignee:
            Graeme Rocher
            Reporter:
            Cesar Arevalo
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development