Trying to parse CSV file in Grails -


i'm trying parse csv file has 3 fields.

my method looks this:

// action called when user submits upload form def handle() {     commonsmultipartfile file = request.getfile('filecsv')     if(file.empty) {         flash.error = g.message(code:'',default:'empty cannot uploaded')     } else {         inputstream fs = file.inputstream         fs.spliteachline(',') { row ->             new connection(                     randomizedid: row[0],                     token1: row[1],                     token2: row[2]             ).save(flush: true)              key++              println("connection added")         }     } } 

looking @ output, line "connection added" printed multiple times. when go looking @ connection list, there none...


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -