-
- obj = questionService.showSubjectInfo(subjectid,subjectType);
- Teacher teacher = (Teacher) ActionContext.getContext().getSession()
- .get("teacherInfo");
- int departid = teacher.getDepartment().getDepartId();
- List<Object[]> courseList = courseService.findAllCourseByDepart(1, 10, departid);
- Object[] o = new Object[]{courseList};
- obj.add(o);
-
- return "success";
javascript代码:
- var data = xmlReq.responseText;
- var list = eval("(" + data + ")");
- var div = document.getElementById("dialog");
- var result = "请选择课程:<select>";
-
- var courses = list.obj[1];
- var courseList = courses[0];
-
- for(var k = 0 ; k< courseList.length ; k ++){
- var courseVal = courseList[k];
- result +="<option value = '" + courseVal[0]+ "' > " +courseVal[1]+"</option>";
- }
- result += "</select><br/>";
-
- for(var i = 0 ; i < list.obj.length; i ++){
- var o = list.obj[i];
- if(i ==0){
- result += "<lable>title</lable><br/><span><textarea name = 'title' style = 'width:90%;height:100px;'>" + o[1]+ "</textarea></span><br/><label>options</label><br/>";
- result += "<table border = '1' id = 'mytable'>";
- var arr = new Array();
- arr = o[2].split('‖');
- for(var j = 0 ; j < arr.length; j=j +2){
- result += "<tr><td><span><input type = 'checkbox'/></td><td> " + arr[j]+ "<input class = 'answer' name = 'selectOption' type = 'text' value = '" + arr[j + 1]+"'/></span></td></tr>";
- }
- }
-
- }
- result += "</table><input type = 'submit' value = '增加选项' onclick = 'addOption()'><input type = 'submit' value = '删除选项' onclick = 'delOption()'/><br/></input><input type = 'submit' value = 'update' onclick = 'updateSelect()'>"
- div.innerHTML = result;
- show();