Grails read data from file and store it in an object -


i trying read file within controller , store data in object, cant manage save properly. can help? new in groovy/grails...

file generals = new file("c:/grails/grails-3.3.0/ggts/test/data.txt") def line = generals.readlines() def date = new setdate(params) date.save()  date.title = ${line[0]} date.location = ${line[1]} date.description = ${line[2]} date.name = ${line[3]} date.email = ${line[4]}  date.save() 

you may change ${line[0]} "${line[0]}" , things alike if want use string interpolation.

and line list of string, change ${line[0]} line[0] ok.


Comments

Popular posts from this blog

python - Operations inside variables -

Generic Map Parameter java -

arrays - What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it? -