Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/wpf/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
我无法理解下面jsp代码中的错误 异常是什么?在与jdbc相关的调用周围没有try/catch块,可能会引发异常。首先,使用try/catch块,然后,将这些调用移到类中的方法中,至少为了清晰起见,将它们移到JSP之外。描述服务器遇到了一个内部错误,使其无_Jsp - Fatal编程技术网

我无法理解下面jsp代码中的错误 异常是什么?在与jdbc相关的调用周围没有try/catch块,可能会引发异常。首先,使用try/catch块,然后,将这些调用移到类中的方法中,至少为了清晰起见,将它们移到JSP之外。描述服务器遇到了一个内部错误,使其无

我无法理解下面jsp代码中的错误 异常是什么?在与jdbc相关的调用周围没有try/catch块,可能会引发异常。首先,使用try/catch块,然后,将这些调用移到类中的方法中,至少为了清晰起见,将它们移到JSP之外。描述服务器遇到了一个内部错误,使其无,jsp,Jsp,我无法理解下面jsp代码中的错误 异常是什么?在与jdbc相关的调用周围没有try/catch块,可能会引发异常。首先,使用try/catch块,然后,将这些调用移到类中的方法中,至少为了清晰起见,将它们移到JSP之外。描述服务器遇到了一个内部错误,使其无法完成此请求。异常org.apache.jasper.JasperException:在第32行处理JSP页面/uploadfile.JSP时发生异常 <% String rtempfile = File.cre

我无法理解下面jsp代码中的错误
异常是什么?在与jdbc相关的调用周围没有try/catch块,可能会引发异常。首先,使用try/catch块,然后,将这些调用移到类中的方法中,至少为了清晰起见,将它们移到JSP之外。描述服务器遇到了一个内部错误,使其无法完成此请求。异常org.apache.jasper.JasperException:在第32行处理JSP页面/uploadfile.JSP时发生异常
<%

            String rtempfile = File.createTempFile("temp","1").getParent();            
            MultipartRequest multi = new MultipartRequest(request,rtempfile, 15*1024*1024);     // maximum size 15 MB

            Enumeration files = multi.getFileNames();


            String st="insert into documents(filename,type,content)values (?,?,?)";
            PreparedStatement psmt=MyConnection.getConnection().prepareStatement(st);            
            String name="";
            String fileExtesion="";
            File ff =null;
            FileInputStream fin =null;

            while (files.hasMoreElements())
            {
                    name=(String)files.nextElement();                                        
                    ff = multi.getFile(name);
                    fileExtesion = ff.getName().substring(ff.getName().lastIndexOf("."));

                    boolean fileAllowed = fileExtesion.equalsIgnoreCase(".txt")||
                                          fileExtesion.equalsIgnoreCase(".pdf")||
                                          fileExtesion.equalsIgnoreCase(".doc")||
                                          fileExtesion.equalsIgnoreCase(".docx")||
                                          fileExtesion.equalsIgnoreCase(".xls")||
                                          fileExtesion.equalsIgnoreCase(".xlsx");


                    if((ff!=null)&&fileAllowed)
                    {

                            try
                            {
                                    fin=new FileInputStream(ff);
                                    psmt.setString(1, ff.getName());
                                    psmt.setString(2, fileExtesion);
                                    psmt.setBinaryStream(3,(InputStream)fin, (int)(ff.length()));
                                    psmt.setString(4, "Logged User name or ID");        // pass the user name or id 
                                    boolean sss = psmt.execute();

                                    out.print("uploaded successfully..");
                                    out.print("<br/> Go to <a href='downloadfile.jsp'>Download</a> page");
                            }

                            catch(Exception e)
                            {
                                    out.print("Failed due to " + e);
                            }


                            finally
                            {
                            // next statement is must otherwise file will not be deleted from the temp as fin using f.
                             // its necessary to put outside otherwise at the time of exception file will not be closed.
                                    fin.close();
                                    ff.delete();
                            }
                    }
                    else
                    {
                           out.print("Please select the correct file...");
                    }// end of if and else
            }// end of while

            MyConnection.CloseConnection();            
        %>
org.apache.jasper.JasperException: An exception occurred processing JSP page /uploadfile.jsp at line 32

29:             
30: 
31:             String st="insert into documents(filename,type,content) values (?,?,?)";
32:             PreparedStatement psmt=MyConnection.getConnection().prepareStatement(st);
33:             
34:                         
35: