An strange problem occourse on grails 1.2.4 on my machine only….
We are using an custom taglib which can be accessed from services via gspTagLibraryLookup-bean from AppContext.
On my local machine
<my:span value="abc" title="${my.write(text:'123')}"/>
writes:
123<span title="">abc</span> <!-- what i see -->
<span title="123">abc</span> <!-- what my collegue see -->
my:write is defied as:
def write = {out << attrs.text}
But: If i use return instead of out, the html generate what my collegue see.
Anyone know the difference?
Argument value for the
titleattribute is evaluated before passing it to<my:span>. So if you definewriteas{out << attrs.text}, and use it in<my:span>, thewritefunction will write tooutbeforespanfunction does, and return nothing – so123will be written to output before<span>, and the title attribute will be empty.If you define
writeas{return attrs.text}, its evaluation won’t write anything to out, and return123which will be inserted as value oftitleattribute.Not sure why the first definition works on your collegue’s machine.