根据课程号删除课程的时候,课程号(currId)报空指针错误,而且在action中打印也是为null;
这里是action内容://删除所选课程
public String deleteSelected()throws Exception{
//显示该生的学籍信息
HttpServletRequest request=ServletActionContext.getRequest();
String stuId=request.getSession().getAttribute("stuId").toString();
System.out.print("删除所选课程:");
System.out.print(stuId);
        String kcurrId=request.getParameter("currId");
System.out.print(kcurrId);
ResultSet sqlSelect=Dbcon.executeQuery("select * from xuanke,linshic,bascurri,teacher where xuanke.kcurrId=bascurri.currId " +
                " and linshic.xcurrId=bascurri.currId and linshic.xteaId=teacher.teaId " +
                "and stuId=(select stuId from student where stuId='"+stuId+"')");

try{
if(sqlSelect.next())
{
ResultSet sqlSelect1=Dbcon.executeQuery("delete  from xuanke where kcurrId='"+kcurrId+"' and stuId='"+stuId+"'");      sqlSelect.close();
     sqlSelect1.close();
}
}
catch(Exception e){
e.printStackTrace();

}
return SUCCESS;
}
这里是页面内容:
<tr>
    <td width="94" height="32">课程ID号</td>
    <td width="204">课程名称</td>
    <td width="95">授课教师</td>
    <td width="64">上课时间</td>
    <td width="90">课程类型</td>
    <td width="54">退课 </td>
    </tr>
    <s:iterator value="scurrList">
  <tr>
    <td height="30"><s:property value="currId"/></td>
    <td><s:property value="currName"/></td>
    <td><s:property value="teaName"/></td>
    <td>t</td>
    <td><s:property value="xType"/></td>
    <td><a href="deleteSelected.action?id=<s:property value="#session.stuId"/> & currId=<s:property value="currId"/>">退课</a> </td>
    </tr>
    </s:iterator>
 

解决方案 »

  1.   

    <a href="deleteSelected.action?id=<s:property value="#session.stuId"/> & currId=<s:property value="currId"/>"> 点击该连接的时候有没有在浏览器的左下端显示该参数的值 ?除了空指针就没有报类型转换错误?
      

  2.   

    把鼠标放到删除上面的时候,页面下面都有显示stuId 和currId的值,而且报错没有提示类型转换错误,只有空指针错误……“java.lang.NullPorinterException”
      

  3.   

    应该不是,我设置的类型都是varchar