当前位置: 代码迷 >> Java Web开发 >> 谁来帮我看看这个异常到底是什么错啊!!!谢谢了,急啊
  详细解决方案

谁来帮我看看这个异常到底是什么错啊!!!谢谢了,急啊

热度:300   发布时间:2009-12-02 23:14:28.0
谁来帮我看看这个异常到底是什么错啊!!!谢谢了,急啊
<html:form action="startExam.do?action=submitTestPaper" method="post">
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td>
<table id="single" width="90%"  border="0" cellspacing="0" cellpadding="0" align=center>

  <tr>
    <td colspan="4" height=23 style="font-size:11pt;">一、单选题(<font color=red>每题<%=s %>分,答错不得分</font>)</td>
  </tr>
<logic:iterate id="questions" name="singleQue" type="com.exam.struts.form.QuestionForm" scope="request" indexId="ind">
  <tr>
    <td height=23 colspan="4" align=center nowrap>
      <table width="100%"  border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td width="8%" align=right height=23>[&nbsp;${ind+1}&nbsp;]</td>
          <td width="2%">&nbsp;</td>
          <td width="90%" align=left nowrap style="font-size:11pt;"><bean:write name="questions" property="subject" filter="true"/>
          <html:hidden property="idArrS[${ind}]" name="questions"/>
          </td>
        </tr>
      </table>
    </td>
  </tr>
  <tr>
    <td width="8%" height=23 nowrap>&nbsp;</td>
    <td width="3%" align=center nowrap><html:radio property="answerArrS[${ind}]" styleClass="noborder" value="A"/></td>
    <td width="3%" align=center nowrap>A.</td>
    <td width="86%" align=left nowrap><bean:write name="questions" property="optionA" filter="true"/></td>
  </tr>
  <tr>
    <td width="8%" height=23 nowrap>&nbsp;</td>
    <td width="3%" align=center nowrap><html:radio property="answerArrS[${ind}]" styleClass="noborder" value="B"/></td>
    <td width="3%" align=center nowrap>B.</td>
    <td width="86%" align=left nowrap><bean:write name="questions" property="optionB" filter="true"/></td>
  </tr>
  <tr>
    <td width="8%" height=23 nowrap>&nbsp;</td>
    <td width="3%" align=center nowrap><html:radio property="answerArrS[${ind}]" styleClass="noborder" value="C"/></td>
    <td width="3%" align=center nowrap>C.</td>
    <td width="86%" align=left nowrap><bean:write name="questions" property="optionC" filter="true"/></td>
  </tr>
  <tr>
    <td width="8%" height=23 nowrap>&nbsp;</td>
    <td width="3%" align=center nowrap><html:radio property="answerArrS[${ind}]" styleClass="noborder" value="D"/></td>
    <td width="3%" align=center nowrap>D.</td>
    <td width="86%" align=left nowrap><bean:write name="questions" property="optionD" filter="true"/></td>
  </tr>
  </logic:iterate>
</table>

<table id="single" width="90%"  border="0" cellspacing="0" cellpadding="0" align=center>

  <tr>
    <td colspan="4" height=23 style="font-size:11pt;">二、多选题(<font color=red>每题<%=m%>分,答错不得分</font>)</td>
  </tr>
<logic:iterate id="questions" name="moreQue" type="com.exam.struts.form.QuestionForm" scope="request" indexId="ind">
  <tr>
    <td height=23 colspan="4" align=center nowrap>
      <table width="100%"  border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td width="8%" align=right height=23>[&nbsp;${ind+1}&nbsp;]</td>
          <td width="2%">&nbsp;</td>
          <td width="90%" align=left nowrap style="font-size:11pt;"><bean:write name="questions" property="subject" filter="true"/>
          <html:hidden property="idArrM[${ind}]" name="questions"/>
          </td>
        </tr>
      </table>
    </td>
  </tr>
  <tr>
    <td width="8%" height=23 nowrap>&nbsp;</td>
    <td width="3%" align=center nowrap><html:multibox property="moreSelect[${ind}].answerArr" styleClass="noborder" value="A"/></td>
    <td width="3%" align=center nowrap>A.</td>
    <td width="86%" align=left nowrap><bean:write name="questions" property="optionA" filter="true"/></td>
  </tr>
  <tr>
    <td width="8%" height=23 nowrap>&nbsp;</td>
    <td width="3%" align=center nowrap><html:multibox property="moreSelect[${ind}].answerArr" styleClass="noborder" value="B"/></td>
    <td width="3%" align=center nowrap>B.</td>
    <td width="86%" align=left nowrap><bean:write name="questions" property="optionB" filter="true"/></td>
  </tr>
  <tr>
    <td width="8%" height=23 nowrap>&nbsp;</td>
    <td width="3%" align=center nowrap><html:multibox property="moreSelect[${ind}].answerArr" styleClass="noborder" value="C"/></td>
    <td width="3%" align=center nowrap>C.</td>
    <td width="86%" align=left nowrap><bean:write name="questions" property="optionC" filter="true"/></td>
  </tr>
  <tr>
    <td width="8%" height=23 nowrap>&nbsp;</td>
    <td width="3%" align=center nowrap><html:multibox property="moreSelect[${ind}].answerArr" styleClass="noborder" value="D"/></td>
    <td width="3%" align=center nowrap>D.</td>
    <td width="86%" align=left nowrap><bean:write name="questions" property="optionD" filter="true"/></td>
  </tr>
  </logic:iterate>
</table>        
        </td>
      </tr>
        <tr>
          <td align="center"><html:submit property="submit" styleClass="btn_grey" value="交卷"/>          </td>
        </tr>
      </table>
      </html:form>
这提交后出现下面异常

Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

javax.servlet.ServletException: BeanUtils.populate
    org.apache.struts.util.RequestUtils.populate(RequestUtils.java:495)
    org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:805)
    org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:203)
    org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
    org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    com.exam.struts.form.CharFilter.doFilter(CharFilter.java:28)


root cause

java.lang.NullPointerException
    org.apache.commons.beanutils.PropertyUtils.setIndexedProperty(PropertyUtils.java:1458)
    org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:1013)
    org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:808)
    org.apache.struts.util.RequestUtils.populate(RequestUtils.java:493)
    org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:805)
    org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:203)
    org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
    org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    com.exam.struts.form.CharFilter.doFilter(CharFilter.java:28)


note The full stack trace of the root cause is available in the Apache Tomcat/5.5.25 logs.
这是form里的
public class QuestionForm extends ActionForm {

    private int id;
   
    private int taotiID;

    private int lessonID;
   
    private String lessonName;
   
    private String taotiName;
   
    private String type;
        
    private String subject;
   
    private String optionA;

    private String optionB;
   
    private String optionC;
   
    private String optionD;

    private String answer;
   
    private String[] answerArray;
   
    private String[] answerArrS;
   
    private MoreSelect[] moreSelect;
   
    private int[] dellArray;

    private String note;
   
    private int[] idArrS;
   

    private int[]  idArrM;
有谁能帮看下啊 ,找了很久了,急啊!!!!
搜索更多相关主题的帖子: request  action  border  

----------------解决方案--------------------------------------------------------
NullPointerException一般都是你数据没取到,看看你提交的地方,在action或者servlet里打印一下你提交的数据。

----------------解决方案--------------------------------------------------------
你应该在form里面加上获取字段的信息

pubic void Setid(int id){
this.id=id;
}

public int getid(){
return id;
}

其他的信息类似
----------------解决方案--------------------------------------------------------
  相关解决方案