Java 为什么标记库测试抛出GrailStageException?
假设我有一个TagLib使用Java 为什么标记库测试抛出GrailStageException?,java,exception,grails,taglib,Java,Exception,Grails,Taglib,假设我有一个TagLib使用FormatTagLib: class MyTagLib { def something = {attrs, body -> def format = new FormatTagLib() out << format.formatDate(attrs.date, format: 'HH:mm') } } 为什么此代码会引发formatDate异常 org.codehaus.groovy.grails.web.taglib
FormatTagLib
:
class MyTagLib {
def something = {attrs, body ->
def format = new FormatTagLib()
out << format.formatDate(attrs.date, format: 'HH:mm')
}
}
为什么此代码会引发formatDate
异常
org.codehaus.groovy.grails.web.taglib.exceptions.GrailsTagException: Tag [formatDate] does not exist. No corresponding tag library found.
有几件事:
类MyTagLib{
静态名称空间=“myTags”
def something={attrs,body->
非常感谢您的关注。是否有什么特别的东西可以将一个域对象作为参数传递给applyTemplate
?我没有得到这样的属性:类的myProperty:org.codehaus.groovy.runtime.GStringImpl
。applyTemplate的第二个可选参数获取一个映射,用于解释您拥有的任何“模型”对象我已经运行了我发布的代码,测试已经编译并通过了。如果没有具体的例子来说明myProperty的问题,那么很难提供更多帮助。
org.codehaus.groovy.grails.web.taglib.exceptions.GrailsTagException: Tag [formatDate] does not exist. No corresponding tag library found.