java - Effective way to parse list from spring to jsp array -


i looking effective approach put values spring jsp array.

right now, have working code

    var data = google.visualization.arraytodatatable([       ['date', '${campaign.answer1}', '${campaign.answer2}', '${campaign.answer3}'],       <c:foreach var="campaignsperday" items="${campaignsperday}">       ['${campaignsperday.date}',  ${campaignsperday.votes1},  ${campaignsperday.votes2}, ${campaignsperday.votes3}],       </c:foreach>       ['date', '10', '20', '30']     ]); 

but there problem, , , @ end of line ...{campaign.answer3}'],

if remove hardcoded ['date', '10', '20', '30'], not functionable, because looks :

var data = google.visualization.arraytodatatable([           ['date', 'no', 'neutral', 'yes'],            ['sun apr 06 00:00:00 cest 2014',  4,  1, 2],            ['mon apr 07 00:00:00 cest 2014',  3,  30, 15],            ['tue apr 08 00:00:00 cest 2014',  19,  5, 7],          ]); 

the , on last line ruins well-formated code. need :

var data = google.visualization.arraytodatatable([           ['date', 'no', 'neutral', 'yes'],            ['sun apr 06 00:00:00 cest 2014',  4,  1, 2],            ['mon apr 07 00:00:00 cest 2014',  3,  30, 15],            ['tue apr 08 00:00:00 cest 2014',  19,  5, 7]          ]); 

i able solve issue, not in "nice" or "effective" way.

what should best approach? can pre-parse in controller class if needed.


Comments

Popular posts from this blog

javascript - jquery or ashx not working -

opencv - DataType<cv::detail::deriv_type>::depth what is it used for -

python 3.x - Mapping specific letters onto a list of words -