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

javascript - three.js lot of meshes optimization -

smartface.io - Proper way to change color scheme for whole application -

Email notification in google apps script -