var strScore = document.getElementsByName("txtChapterScore"); for (i = 0; i < strScore.length; i++) { QuestionTypeIdDegree += strScore[i].id + ","; TypeChapterDegreeScore += strScore[i].value + ","; } String[] QuestionTypeIdDegree = strlinshi.split(","); List<String> listQuestionTypeIdDegree=new ArrayList<String>(); for (int i = 0; i < QuestionTypeIdDegree.length; i++) { listQuestionTypeIdDegree.add(QuestionTypeIdDegree[i]); }