grails ajax onload和oncomplete

grails ajax onload和oncomplete,ajax,grails,Ajax,Grails,有谁能给我一个在下面的阅读器操作中使用GrailsAjax onload和oncomplete函数的示例代码吗?我想在该操作为onload时显示微调器图标,并在操作为oncomplete时重定向到列表页 def reader(){ def list = [] def dir = new File("C:/Users/User/Desktop/Summarize_20141212/HR_FILE") dir.eachFil

有谁能给我一个在下面的阅读器操作中使用GrailsAjax onload和oncomplete函数的示例代码吗?我想在该操作为onload时显示微调器图标,并在操作为oncomplete时重定向到列表页

def reader(){


            def list = []
            def dir = new File("C:/Users/User/Desktop/Summarize_20141212/HR_FILE")
            dir.eachFileRecurse(FileType.FILES) { file ->
                list << file
            }
            println list
            list.each {
                File file = new File(it.path)
                def sql = groovy.sql.Sql.newInstance("jdbc:postgresql://localhost:5432/new",
                        'postgres', 'sa', "org.postgresql.Driver")
                def lincoln = 0
                file.eachLine() { line ->
                    if (line.trim().size() == 0) {
                        return null
                    } else {
                        def field = []
                        def tokens = line.split(',(?=([^\"]*\"[^\"]*\")*[^\"]*$)')
                        file.name.lastIndexOf('.').with { it != -1 ? file.name[0..<it] : file.name }
                        lincoln++
                        field.push(file.name)
                        for (String t : tokens) {
                            field.push(t)
                        }
                        while (field.size() < 10) {
                            field.push("")
                        }
                        if (lincoln > 1) {
                            sql.execute('insert into read_hr(version,col01,col02,col03,col04,col05,col06,col07,col08,col09,col10)' +
                                    'VALUES (0,?,?,?,?,?,?,?,?,?,?)', field)
                            System.out.println(field);

                        }
                    }
                }


            }


redirect (action:"list")

    }

这些链接将对您有用。