谁能给我示例代码,该代码在跟随阅读器操作时使用grails ajax 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")
}
最佳答案
这些链接将对您有用。
http://www.javacodegeeks.com/2013/05/grails-ajax-examples.html
http://javadeveloper.asia/grails-ajax-tutorial-remotelink-tag
关于ajax - 使ajax onload和oncomplete失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28209476/