if (strCode!=null){
   ....

解决方案 »

  1.   

    if (!strCode.equals("")){
    .....
      

  2.   

    TO tin_dra 还是不行
    Root cause:
    java.lang.NullPointerException
      

  3.   

    if(strCode!=null){
    ......
    应该是可以的
      

  4.   

    在客户端判断,if(document.all("checkboxname").length==0) {return false;}
      

  5.   

    to ;beyond_xirou 
    按你的建议我用JS来判断,方法如下;
    <script language="javascript">
    function sub(){
      if(document.all("mid").length==0){
          return false;
       }else{
     document.Area.submit();
      }
    }
    </script>
    ..
    <form name="Area" action="Area_ok" method="post">
    ..
    <input type="button" name="Delete Checked Control" value="Delete Checked Control" onclick="sub()">
    ...
    <input type="checkbox" name=mid value="<%=Rs.getString("AreaCode")%>">
    .....不知道这样写对不对,还是会出现空指针异常!
      

  6.   

    function del() {    //删除函数
    oform   = document.form1;
        var iNum= 0;
        iLength = oform.mid.length;
        for (i = 0; i < iLength; i++) {
            if (iLength == 1) {
                if (oform.mid.checked) {
                    iNum++;
                    break;
                }
            } else {
                if (oform.mid[i].checked) {
                    iNum++;
                    break;
                }
            }
        }
        if (iNum == 0) {
            alert("请先选择要删除的项!");
            return;
        }
        oform.action    = "jsp2.jsp";
        oform.submit();
    }jsp1.jsp
    ....
    <form name="form1"action ="jsp2.jsp" method="post">
    ....
    <input type="button" onclick="del();" name="Delete Checked Control" value="Delete Checked Control">
    ....
    <tr><td width="4%"><div align="center">
    <input type="checkbox" name=mid value="+Rs.getString("Code"));
    ....