问题描述
在页面中<FORMid="jspForm"method="post"name="jspnForm"action="exam.do?operate=Stu_exam_answer"><logic:notEmptyname="stu_exam_list"><inputtype="hidden"name="sq_id"><logic:iterateid="exam"name="stu_exam_list"type="com.aftvc.exam.entity.Exam"indexId="s"><TR><TDclass="dotest_col1"height="26"align="center"colspan="3"><divclass="content-box"><!--StartContentBox--><divclass="content-box-header"><h3>第<%=s+1%>题</h3><ulclass="content-box-tabs"><!--hrefmustbeuniqueandmatchtheidoftargetdiv--></ul></div><!--End.content-box-header--><divclass="content-box-content"><!--End#tab1--><divclass="tab-content"id="tab2"><divclass="notificationsuccesspng_bg"><divclass="conList"><tablewidth="600"border="0"cellpadding="0"cellspacing="0"><tr><tdcolspan="2"align="left"><spanclass="conList"><strong>${exam.sq_question}</strong></span></td></tr><tr><tdwidth="31"align="right">(A)</td><tdwidth="559"align="left"> ${exam.sq_question_A}</td></tr><tr><tdalign="right">(B)</td><tdalign="left"> ${exam.sq_question_B}</td></tr><tr><tdalign="right">(C)</td><tdalign="left"> ${exam.sq_question_C}</td></tr><tr><tdalign="right">(D)</td><tdalign="left"> ${exam.sq_question_D}</td></tr></table></div></div></div><!--End#tab2--></div><!--End.content-box-content--><divclass="exam-box-selectAnswer"><tablewidth="760"border="0"><tr><td><divalign="left"><strong><spanclass="conList">选择答案:</span> <spanclass="conList">A</span><inputtype="radio"name="${exam.sq_id}"value="radiobutton"/> <spanclass="conList">B</span><inputtype="radio"name="${exam.sq_id}"value="radiobutton"/> <spanclass="conList">C</span><inputtype="radio"name="${exam.sq_id}"value="radiobutton"/> <spanclass="conList">D</span><inputtype="radio"name="${exam.sq_id}"value="radiobutton"/></strong></div></td></tr></table></div></div></TD></TR></logic:iterate></logic:notEmpty>我想把页面出现的试题,及我选的答案在另一个页面输出在struts的action中publicActionForwardtoStu_exam_list(ActionMappingmapping,ActionFormform,HttpServletRequestrequest,HttpServletResponseresponse)throwsIOException{PrintWriterout=response.getWriter();ExamFormexamForm=(ExamForm)form;//TODOAuto-generatedmethodstubListstu_exam_list=examInfoBiz.getExamList(56);//通过科目id查找试卷列表System.out.println(stu_exam_list.size());if(stu_exam_list.size()!=0){request.setAttribute("stu_exam_list",stu_exam_list);returnmapping.findForward("stu_exam");}else{out.print("<script>alert('没有所选科目的相关试题!')</script>");response.sendRedirect("../student/index.jsp");returnnull;}}publicActionForwardStu_exam_answer(ActionMappingmapping,ActionFormform,HttpServletRequestrequest,HttpServletResponseresponse)throwsIOException{PrintWriterout=response.getWriter();ExamFormexamForm=(ExamForm)form;//TODOAuto-generatedmethodstubHttpSessionsession=request.getSession(false);Liststu_exam_list=(List)session.getAttribute("stu_exam_list");System.out.println(stu_exam_list.size());//空指针打印不出来Examexam1=(Exam)stu_exam_list.get(19);System.out.println(exam1.getSq_question());for(inti=0;i<stu_exam_list.size();i++){Examexam=(Exam)stu_exam_list.get(i);System.out.println(exam.getSq_question());//空指针}returnmapping.findForward("stu_exam_answer");}怎么没有值传过来,蛮烦各位帮我找一下啊,我找了很长时间没找出来,谢谢!