Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/grails/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html grailstaglibg:SELECT_Html_Grails_Taglib - Fatal编程技术网

Html grailstaglibg:SELECT

Html grailstaglibg:SELECT,html,grails,taglib,Html,Grails,Taglib,我是Grails平台的新手,对TagLib组件很感兴趣。 我有一个应用程序,其中我要创建一个时间选择[24小时格式选择],由两个标签组成:小时和时间。到目前为止,我已经用这种方式编码了我的理论 def timePicker = { attrs -> out << "<g:select name='" + attrs['name'] + ".hour' from='${00..21}' />" out << "<g:select name

我是Grails平台的新手,对TagLib组件很感兴趣。 我有一个应用程序,其中我要创建一个时间选择[24小时格式选择],由两个标签组成:小时和时间。到目前为止,我已经用这种方式编码了我的理论

def timePicker = { attrs ->
   out << "<g:select name='" + attrs['name'] + ".hour' from='${00..21}' />"
   out << "<g:select name='" + attrs['name'] + ".minute' from='${00..59}' />" 
}
def timePicker={attrs->

out您只能在GSP中使用方法调用:

def timePicker = { attrs ->
    out << "${select(from: 00..21, name: attrs.name + '.hour')}"
    out << "${select(from: 00..59, name: attrs.name + '.minute')}"
 }
def timePicker={attrs->

out您只能在GSP中使用方法调用:

def timePicker = { attrs ->
    out << "${select(from: 00..21, name: attrs.name + '.hour')}"
    out << "${select(from: 00..59, name: attrs.name + '.minute')}"
 }
def timePicker={attrs->

out您可以使用以下内容:

def timePicker = { attrs ->
    def hours = 0..21
    def stringHours = hours.collect{ String.format('%02d', it) }

    def minutes = 0..59
    def stringMinutes = minutes.collect{ String.format('%02d', it) }

    out << "${select(from: stringHours, name: attrs.name + '.hour')}"
    out << "${select(from: stringMinutes, name: attrs.name + '.minute')}"
}
def timePicker={attrs->
def小时数=0..21
def stringHours=hours.collect{String.format('%02d',it)}
def分钟数=0..59
def stringMinutes=minutes.collect{String.format(“%02d”,it)}

out您可以使用以下内容:

def timePicker = { attrs ->
    def hours = 0..21
    def stringHours = hours.collect{ String.format('%02d', it) }

    def minutes = 0..59
    def stringMinutes = minutes.collect{ String.format('%02d', it) }

    out << "${select(from: stringHours, name: attrs.name + '.hour')}"
    out << "${select(from: stringMinutes, name: attrs.name + '.minute')}"
}
def timePicker={attrs->
def小时数=0..21
def stringHours=hours.collect{String.format('%02d',it)}
def分钟数=0..59
def stringMinutes=minutes.collect{String.format(“%02d”,it)}

谢谢。但是有没有办法把一位数[0-9]格式化成两位数的
0\d
?谢谢。谢谢。但是有没有办法把一位数[0-9]格式化成两位数的
0\d
?谢谢。