当前位置:首页
开发技术指南» 文章正文
    引言:

    摘要: 办公室里几台机都中了,查出是 病毒名称: w32.jeefo 文件: c:\windows\svchost.exe 位置:c:\windows 计算机:foundert-65e48f 用户:system 采用的操作:清除 失败 : 隔离 失败 : 拒绝访问 发现的日期: 2005年9月8日 19:22:5 ........... ........... ........... 有什么好的方......
 ·怎样做个漂亮的界面    »显示摘要«
    摘要: 我用vs做了个asp.net的程序,界面上也是用的web控件,但总觉得他很难看, 比如textedit,radio,button等感觉还是98下的应用程序,与web的多恣多彩不相匹配。 由于我是新手,请问各位有没什么好的解决方案。要是能做成一个类似xp风格的也好。 ......


求助在线等,解决立刻接贴

我现在有一个jsp文件,调用了javabean   从数据库里取出数据,jsp页面可以正常显示数据库数据,可是在我点击提交按钮以后,就出现了如下错误:  
  java.lang.NumberFormatException:   null  
  at   java.lang.Long.parseLong(Long.java:363)  
  at   java.lang.Long.parseLong(Long.java:452)  
                    at   org.apache.jsp.fsurveyContent$jsp._jspService(fsurveyContent$jsp.java:122)  
  at   org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)  
  at   javax.servlet.http.HttpServlet.service(HttpServlet.java:853)  
  at   org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:201)  
  at   org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:381)  
  at   org.apache.jasper.servlet.JspServlet.service(JspServlet.java:473)  
  at   javax.servlet.http.HttpServlet.service(HttpServlet.java:853)  
  at   org.apache.catalina.core.ApplicationFilterChain.internalDoFilter                           ApplicationFilterChain.java:247)  
   
  ......  
  long   类型我就在jsp页面里调用了parseLong方法,要是它出错,jsp页面就不应该能够显示出数据库的内容的,因为long类型是作为一个条件传给Bean进行查询的,为什么在点击按钮后不调用script反而出现这种错呢?请高手帮帮忙,谢谢了!在线等  
   
  QuerySurveyBean.java   所用到的代码如下:  
    public   void   setSurveyNum(Long   num)  
      {  
          surveyNum=num;  
      }  
  public   StringBuffer   getSurveyInfo()  
      {  
          StringBuffer   surveyInfo=new   StringBuffer();  
   
          Connection   conn=null;  
          Statement   stat=null;  
          ResultSet   rs=null;  
          conn=dbConn();//连接数据库  
   
          String   sql="select   Title,Vote_class,Vote_title,Vote_count   from   SYS_STATASSESS_INFO   as   a,SYS_VOTE_INFO   as   b   where   a.Stat_id="+surveyNum+"   and   b.Stat_id="+surveyNum+"";  
   
          try{  
              stat=conn.createStatement();  
              rs=stat.executeQuery(sql);  
   
              String   []   survey=new   String[3];  
   
              int   i=0;//  
              int   j=0;//  
               
   
              while(rs.next())  
              {  
                  survey[0]=rs.getString("Title");  
                  survey[1]=rs.getString("Vote_class");  
                  survey[2]=rs.getString("Vote_title");  
                  if(survey[0]!=""&&j==0)  
                  {  
                      surveyInfo.append("<tr   bgColor=#e6e6e6   align=left>");  
                      surveyInfo.append("<td   class=title1>"   +"一周内最新评议题目:"+   survey[0]   +   "&nbsp;&nbsp;&nbsp;&nbsp;</td>");  
                      surveyInfo.append("</tr>");  
                      j++;  
                  }  
   
   
                  surveyInfo.append("<tr>");  
               
                  surveyInfo.append("<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input   type=radio   width=50   name=survey   value="+survey[1]+"/>&nbsp;&nbsp;&nbsp;");  
                  surveyInfo.append(survey[1]+"&nbsp;&nbsp;&nbsp;&nbsp;");  
                  surveyInfo.append(survey[2]+"</td>");  
                  surveyInfo.append("</tr>");  
                  i++;  
              }  
              if(i==0)  
              {  
                  surveyInfo.append("<tr><td   >没有内容!</td><tr>");  
              }  
              if(j==0)  
              {  
                      surveyInfo.append("<tr><td   >没有!</td><tr>");  
              }  
   
           
          }catch(Exception   e){  
              System.out.println(e);  
          }  
         
          Dbconn   a=new   Dbconn();  
          a.dbClose(conn);  
          return   surveyInfo;  
      }  
  fsurveyContent.jsp的代码如下:  
   
  <%@   page   contentType="text/html;   charset=GBK"   %>  
  <%@   page   import="qtcommon.QuerySurveyBean"   %>  
   
  <%!//处理字符串的方法  
        public   String   codeString(String   s)  
        {  
            String   str=s;  
            try{  
                byte   b[]=str.getBytes("ISO-8859-1");  
                str=new   String(b);  
                return   str;  
            }catch(Exception   e)  
              {  
                  return   str;  
              }  
        }  
  %>  
  <html>  
  <head>  
  <title>  
  最新评议内容  
  </title>  
  <link   rel="stylesheet"   href="../css/style.css"   type="text/css">  
   
  <script   language="javascript">  
    <!--  
    function   chkInput()  
    {  
          if(form1.survey.value=="")  
          {  
              alert("请选择您认为合适的评议项后再提交!");  
              return   false;  
            }  
    return   true;  
    }  
      //-->  
  </script>  
  </head>  
  <body       bgcolor="#EFF3FF">  
      <form   action="fsurveyContent.jsp"   method="POST"   name="form1">  
      <jsp:useBean   id="surveyinfo"   scope="application"   class="qtcommon.QuerySurveyBean">  
      </jsp:useBean>  
      <%   //获取最新评议的编码,在数据库中是bigint类型,在前一页面已经取出,正确  
            String   surveynum1=request.getParameter("title");  
            java.lang.Long   surveynum=new   Long(Long.parseLong(surveynum1));  
      %>  
       
   
  <table   width="100%"   border="0"   align="center"   cellpadding="0"   cellspacing="0">  
      <tr>  
          <td>  
   
                  <table     width="100%"   border="0"   align="center"   cellpadding="3"   cellspacing="0"     bgcolor="#EFF3FF">  
                                <jsp:setProperty   name="surveyinfo"   property="surveyNum"   value="<%=surveynum%>"/>  
                                  <%  
                                          StringBuffer   survey=surveyinfo.getSurveyInfo();  
                                  %>  
                                  <%=survey%>  
                          <tr>  
                              <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  
                                  <input   name="Button"   type="submit"   class="button"   value="提交"     onClick="return   chkInput()">&nbsp;&nbsp;&nbsp;&nbsp;  
                                  <input     class="button"   type="reset"   name="but1"   value="重置"   />  
                              </td>  
                          </tr>  
                  </table>  
          </td>  
      </tr>  
   
  </table>  
  </form>  
  <%  
            String   voteinfo="";  
            //提交后,进行的操作  
              voteinfo=request.getParameter("survey");  
              voteinfo=codeString(voteinfo);  
              out.print("您投了"+voteinfo+"1票!");      
      %>  
   
  </body>  
  </html>

NO.1   作者: eidolon_warrior

java.lang.NumberFormatException:   null  
   
  提交的数据的数据类型不符   或者为空

NO.2   作者: nkat

上面的说的对

NO.3   作者: jason_chan1982

null也可能是你哪里对象没有实例化  
 

NO.4   作者: qybao

大概看了下,我觉得这里应该有点问题吧  
  String   surveynum1=request.getParameter("title");  
  java.lang.Long   surveynum=new   Long(Long.parseLong(surveynum1));  
   
  你第一次访问这个jsp页面的时候,也就是前一页面,应该有个title请求参数的吧,  
  所以进入jsp页面时String   surveynum1=request.getParameter("title");取到的surveynum1为非空,java.lang.Long   surveynum=new   Long(Long.parseLong(surveynum1));转换不会出错,你的sql语句也能正常执行  
  然而你点击按钮的时候,再次进入这个jsp页面的时候,因为该页面没有title请求参数,所以String   surveynum1=request.getParameter("title");取到的surveynum1为空,于是java.lang.Long   surveynum=new   Long(Long.parseLong(surveynum1));转换就出错了  
   
   
   
 

NO.5   作者: congliu

从代码上看不出,建议楼主输出变量,判断是否没有初始化

NO.6   作者: simon0512

java.lang.Long   surveynum=new   Long(Long.parseLong(surveynum1));  
  加上try,catch试试

NO.7   作者: angelyangplus

提交的连接传递的值有问题吧,好好检查下值是怎么传的^^


    摘要: 以前打开pb,pbl下的各数据窗口均显示在界面右边,可以只观查看各数据窗口的信息。小弟我不知道搞了个什么东东后将其关闭了,右边的那个栏目不见了,关闭后再次登陆还是无法显示。现在很困惑,寻求pb达人相助! ......
» 本期热门文章:

©2000-2007 All Rights Reserved. 最佳浏览:1024X768 MSIE