Quantcast

Use custom tags with method notation inside a GSP?

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Use custom tags with method notation inside a GSP?

enTropy Fragment
Hello there!

I'm having problems with custom tags with a defined namespace.

They are used inside a GSP with no problem at all as long as I stick to the xml notation, but when I use the method notation they are not "detected".

An example:

TagLib:
class ExampleTagLib {
static namespace = "ex"

def example = { out << 'Hello' }
}

GSP:
<ex:example />      <-- This works
${ex.example()}       <-- This does NOT work :(


Why is this happening? How can I make it work? Looked for a while but couldn't find any related post


PS: Running Grails 1.3.7
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Use custom tags with method notation inside a GSP?

Lauro Becker
Hi

Try adding attrs on your tag. E.g:

def example = { attrs -> out << 'Hello' }

Cheers,

Lauro L. V. Becker
---------------------------
Blog: http://laurobecker.wordpress.com


2012/2/7 enTropy Fragment <[hidden email]>
Hello there!

I'm having problems with custom tags with a defined namespace.

They are used inside a GSP with no problem at all as long as I stick to the xml notation, but when I use the method notation they are not "detected".

An example:

TagLib:
class ExampleTagLib {
static namespace = "ex"

def example = { out << 'Hello' }
}

GSP:
<ex:example />      <-- This works
${ex.example()}       <-- This does NOT work :(


Why is this happening? How can I make it work? Looked for a while but couldn't find any related post


PS: Running Grails 1.3.7

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Use custom tags with method notation inside a GSP?

enTropy Fragment
It's not working :(

2012/2/7 Lauro Becker <[hidden email]>
Hi

Try adding attrs on your tag. E.g:

def example = { attrs -> out << 'Hello' }

Cheers,

Lauro L. V. Becker
---------------------------
Blog: http://laurobecker.wordpress.com



2012/2/7 enTropy Fragment <[hidden email]>
Hello there!

I'm having problems with custom tags with a defined namespace.

They are used inside a GSP with no problem at all as long as I stick to the xml notation, but when I use the method notation they are not "detected".

An example:

TagLib:
class ExampleTagLib {
static namespace = "ex"

def example = { out << 'Hello' }
}

GSP:
<ex:example />      <-- This works
${ex.example()}       <-- This does NOT work :(


Why is this happening? How can I make it work? Looked for a while but couldn't find any related post


PS: Running Grails 1.3.7


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Use custom tags with method notation inside a GSP?

Lauro Becker
Some exception happens?

Lauro L. V. Becker
---------------------------
Blog: http://laurobecker.wordpress.com


2012/2/7 enTropy Fragment <[hidden email]>
It's not working :(


2012/2/7 Lauro Becker <[hidden email]>
Hi

Try adding attrs on your tag. E.g:

def example = { attrs -> out << 'Hello' }

Cheers,

Lauro L. V. Becker
---------------------------
Blog: http://laurobecker.wordpress.com



2012/2/7 enTropy Fragment <[hidden email]>
Hello there!

I'm having problems with custom tags with a defined namespace.

They are used inside a GSP with no problem at all as long as I stick to the xml notation, but when I use the method notation they are not "detected".

An example:

TagLib:
class ExampleTagLib {
static namespace = "ex"

def example = { out << 'Hello' }
}

GSP:
<ex:example />      <-- This works
${ex.example()}       <-- This does NOT work :(


Why is this happening? How can I make it work? Looked for a while but couldn't find any related post


PS: Running Grails 1.3.7



Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Use custom tags with method notation inside a GSP?

enTropy Fragment
Problem solved!

There was a variable defined somewhere else named 'ex'.
It's funny that tag worked properly though.

An exception was throwed, indeed, but it wasn't very helpfull. Something about Groovy could not parse the sentence.

Thanks for replying :)


2012/2/7 Lauro Becker <[hidden email]>
Some exception happens?


Lauro L. V. Becker
---------------------------
Blog: http://laurobecker.wordpress.com


2012/2/7 enTropy Fragment <[hidden email]>
It's not working :(


2012/2/7 Lauro Becker <[hidden email]>
Hi

Try adding attrs on your tag. E.g:

def example = { attrs -> out << 'Hello' }

Cheers,

Lauro L. V. Becker
---------------------------
Blog: http://laurobecker.wordpress.com



2012/2/7 enTropy Fragment <[hidden email]>
Hello there!

I'm having problems with custom tags with a defined namespace.

They are used inside a GSP with no problem at all as long as I stick to the xml notation, but when I use the method notation they are not "detected".

An example:

TagLib:
class ExampleTagLib {
static namespace = "ex"

def example = { out << 'Hello' }
}

GSP:
<ex:example />      <-- This works
${ex.example()}       <-- This does NOT work :(


Why is this happening? How can I make it work? Looked for a while but couldn't find any related post


PS: Running Grails 1.3.7




Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Use custom tags with method notation inside a GSP?

Lauro Becker
OK.

Glad to know! :)

Lauro L. V. Becker
---------------------------
Blog: http://laurobecker.wordpress.com


2012/2/7 enTropy Fragment <[hidden email]>
Problem solved!

There was a variable defined somewhere else named 'ex'.
It's funny that tag worked properly though.

An exception was throwed, indeed, but it wasn't very helpfull. Something about Groovy could not parse the sentence.

Thanks for replying :)



2012/2/7 Lauro Becker <[hidden email]>
Some exception happens?


Lauro L. V. Becker
---------------------------
Blog: http://laurobecker.wordpress.com


2012/2/7 enTropy Fragment <[hidden email]>
It's not working :(


2012/2/7 Lauro Becker <[hidden email]>
Hi

Try adding attrs on your tag. E.g:

def example = { attrs -> out << 'Hello' }

Cheers,

Lauro L. V. Becker
---------------------------
Blog: http://laurobecker.wordpress.com



2012/2/7 enTropy Fragment <[hidden email]>
Hello there!

I'm having problems with custom tags with a defined namespace.

They are used inside a GSP with no problem at all as long as I stick to the xml notation, but when I use the method notation they are not "detected".

An example:

TagLib:
class ExampleTagLib {
static namespace = "ex"

def example = { out << 'Hello' }
}

GSP:
<ex:example />      <-- This works
${ex.example()}       <-- This does NOT work :(


Why is this happening? How can I make it work? Looked for a while but couldn't find any related post


PS: Running Grails 1.3.7





Loading...