I'm testing creating tags in grails.
class HiWorldtagLib{
def sayhi={attrs,body->
def msg="<h1>Hello"+attrs.name+"</h1>";
out<<msg;
}
}
<HiWorld:sayhi name="world"/>
It runs through my tag code but only spits out the HTML with comment <!--
wrapped around it. And also the tag itself in lower case.
Rendered html...
<body>
<!--<h1>Hello world</h1>-->
<hiworld:sayhi name="world"/>
</body>
The default namespace is g
Try this one
<g:sayhi name="world"/>
If you want to keep your namespace, you should add the following property in the taglib class:
static namespace = "HiWorld"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.