Overriding a Tag

View: New views
4 Messages — Rating Filter:   Alert me  

Overriding a Tag

by dear_stephen :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello

I would like to apply a patch to link rendering tags. I would like to automatically insert the parameter "lang" before the link is rendered. This effects tags like link, createLink, form, etc. I need to do this because I want to have the language in the URL, for example

http://localhost:8080/app/en/home


At the moment I have created tags like langLink and createLangLink and am using these in my view code, but if someone else working on the project uses the standard tag I have a problem.

Is it possible to override the standard tags and how could I do this?


Stephen





Re: Overriding a Tag

by dear_stephen :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

The following post is asking the same thing but for a plugin.

http://www.nabble.com/Possible-to-extend-override-ApplicationTagLib--td14123367.html#a18356662


dear_stephen wrote:
Hello

I would like to apply a patch to link rendering tags. I would like to automatically insert the parameter "lang" before the link is rendered. This effects tags like link, createLink, form, etc. I need to do this because I want to have the language in the URL, for example

http://localhost:8080/app/en/home


At the moment I have created tags like langLink and createLangLink and am using these in my view code, but if someone else working on the project uses the standard tag I have a problem.

Is it possible to override the standard tags and how could I do this?


Stephen




Re: Overriding a Tag

by Graeme Rocher-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

The typical way to do this is to create your own tag library under a
different name space:

static namespace = "foo"

Then in your GSP

<foo:link />

Cheers

On Wed, Jul 9, 2008 at 9:23 AM, dear_stephen <stephen@...> wrote:

>
> The following post is asking the same thing but for a plugin.
>
> http://www.nabble.com/Possible-to-extend-override-ApplicationTagLib--td14123367.html#a18356662
>
>
>
> dear_stephen wrote:
>>
>> Hello
>>
>> I would like to apply a patch to link rendering tags. I would like to
>> automatically insert the parameter "lang" before the link is rendered.
>> This effects tags like link, createLink, form, etc. I need to do this
>> because I want to have the language in the URL, for example
>>
>> http://localhost:8080/app/en/home
>>
>>
>> At the moment I have created tags like langLink and createLangLink and am
>> using these in my view code, but if someone else working on the project
>> uses the standard tag I have a problem.
>>
>> Is it possible to override the standard tags and how could I do this?
>>
>>
>> Stephen
>>
>>
>>
>>
>>
>>
>
> --
> View this message in context: http://www.nabble.com/Overriding-a-Tag-tp18301863p18356706.html
> Sent from the grails - user mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>
>



--
Graeme Rocher
Grails Project Lead
G2One, Inc. Chief Technology Officer
http://www.g2one.com

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Re: Overriding a Tag

by dear_stephen :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Graeme

Thanks for the response!

This would also be a solution but if someone uses the <g:link> instead of <foo:link> the wrong link will be created on the page. I would like to avoid this by overriding the <g:link>


Stephen



Graeme Rocher-2 wrote:
The typical way to do this is to create your own tag library under a
different name space:

static namespace = "foo"

Then in your GSP

<foo:link />

Cheers

On Wed, Jul 9, 2008 at 9:23 AM, dear_stephen <stephen@fluidforms.at> wrote:
>
> The following post is asking the same thing but for a plugin.
>
> http://www.nabble.com/Possible-to-extend-override-ApplicationTagLib--td14123367.html#a18356662
>
>
>
> dear_stephen wrote:
>>
>> Hello
>>
>> I would like to apply a patch to link rendering tags. I would like to
>> automatically insert the parameter "lang" before the link is rendered.
>> This effects tags like link, createLink, form, etc. I need to do this
>> because I want to have the language in the URL, for example
>>
>> http://localhost:8080/app/en/home
>>
>>
>> At the moment I have created tags like langLink and createLangLink and am
>> using these in my view code, but if someone else working on the project
>> uses the standard tag I have a problem.
>>
>> Is it possible to override the standard tags and how could I do this?
>>
>>
>> Stephen
>>
>>
>>
>>
>>
>>
>
> --
> View this message in context: http://www.nabble.com/Overriding-a-Tag-tp18301863p18356706.html
> Sent from the grails - user mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>
>



--
Graeme Rocher
Grails Project Lead
G2One, Inc. Chief Technology Officer
http://www.g2one.com

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email