Grails

Inconsistent behavior between GSPResponseWriter and GroovyPageTagWriter

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Critical Critical
  • Resolution: Fixed
  • Affects Version/s: 1.1
  • Fix Version/s: 1.1.1
  • Component/s: TagLib
  • Labels:
    None

Description

I have the following tag lib:

class MyTagLib {
  static namespace = 'my'

  def tag1 = { attrs ->
    out << out.getClass().name << ": [" << attrs.p1 << "] [" << attrs.p2 << "]"
  }

  def tag2 = { attrs ->
    out << my.tag1(p1: "abc") 
  }
}

And the following gsp:

<p>This is tag1: <my:tag1 p1="abc"/></p>
<p>This is tag2: <my:tag2/></p>

The output looks like this:

This is tag1: org.codehaus.groovy.grails.web.pages.GSPResponseWriter: [abc] []

This is tag2: org.codehaus.groovy.grails.web.taglib.GroovyPageTagWriter: [abc] [null]

The behavior of out << null is different between GSPResponseWriter and GroovyPageTagWriter. It seems inconsistent to me.

Activity

Hide
Yan Pujante added a comment -

I just realized that you don't even need to call tag1 from tag2...

You can simply use the 'method call way' from the gsp directly:

<p>This is tag1 from method call: ${my.tag1(p1: 'abc')}</p>

which produces the result:

This is tag1 from method call: org.codehaus.groovy.grails.web.taglib.GroovyPageTagWriter: [abc] [null]
Show
Yan Pujante added a comment - I just realized that you don't even need to call tag1 from tag2... You can simply use the 'method call way' from the gsp directly:
<p>This is tag1 from method call: ${my.tag1(p1: 'abc')}</p>
which produces the result:
This is tag1 from method call: org.codehaus.groovy.grails.web.taglib.GroovyPageTagWriter: [abc] [null]
Hide
Graeme Rocher added a comment -

Seems it has already been fixed during the performance improvements, but I have written a test using your example to avoid regression

Show
Graeme Rocher added a comment - Seems it has already been fixed during the performance improvements, but I have written a test using your example to avoid regression

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: