Blog

  • Nesting custom tags in grails

    Posted by Abhinav Anand | Last Updated: 05-Jun-15

    There are so many cases in which we have to use custom tags and in which we have to use more than one tag at a time; we can say tag nesting. Here I am going to use two custom tags at the same time as per our nee.

    You can create your TagLib class in which you can create custom tags.  Like  :

    def formatAmount={attrs, body->
    		def amount = attrs?.amount
    		def formatedAmount = String.format("%,.2f",amount)
    		if(formatedAmount.contains('.00')){
    			out<

    and another as

    def netAmount={attrs, body->
    		def amount = attrs?.amount
    	    def interestRate=attrs?.interestRate
            def netAmount=amount+(amount*interestRate)/100
    			out<

    And here is the nested tag in view

    
    ${amount}
    

    Thanks

Tags: grails

View All PostsLeave a Comment
comments powered by Disqus

Mobile Applications

Video Content

Bigdata & NoSQL

SaaS Applications

Miscellaneous

Archives


Alexa Certified Site Stats for www.oodlestechnologies.com